On Jun 23, 2004, at 2:49 PM, Joseph J. Strout wrote:
Better would be to simply have your mapArray be an array of GameObjs.
If mapArray(i,j) = nil, then that spot is empty, otherwise you have a
GameObj you can ask things like "can I move into this spot?" and tell
things like "hey, I moved into this spot, do something about it if you
care to."
This does sound like the way to go. I'll have to give it some more
thought right now, because there are cases where one spot may be
occupied by more than one GameObj. For instance, one GameObj could be a
map tile that is like a conveyor belt. There is no reason that another
GameObj like a shot from an enemy couldn't move over that conveyor
belt. In the case where a player is on a conveyor belt and is hit by a
shot... there would be an issue there.
I suppose these special map tiles could / should be in a different
array than objects that might rest on top of said tiles. I really
wanted the moving game objects to only have to check one thing,
though... i.e. I hit object(i), so do object(i).washit(myID) or
something.
Hmm... I could actually create a subclass of Object3D (let's say
mapObj) that can be a composite of gameObj's.
mapObj would keep track of how many gameObj's occupy the mapObj
location.
mapArray is still the 2D array representing the level map, but it is an
array of mapObj's.
When a moving game object checks mapArray, the corresponding mapObj
could then tell all of it's owned gameObj's that "you got hit" by "this
object" so act accordingly.
Okay, that was just rambling out loud. But again, much appreciate the
tips Seth Frank and Joe!
Paul
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|