realbasic-games
[Top] [All Lists]

Re: Question regarding class / subclass

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Question regarding class / subclass
From: Paul Kaiser <buddy at goodlearning dot com>
Date: Wed, 23 Jun 2004 15:07:47 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
List-help: <mailto:realbasic-games-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Games <realbasic-games.lists.realsoftware.com>
List-post: <mailto:realbasic-games@lists.realsoftware.com>
References: <E7690953-C541-11D8-96A8-000A957887E6 at goodlearning dot com> <D421FE62-C546-11D8-8A86-0003933EA538 at si-co dot com> <DA4BDE2A-C549-11D8-96A8-000A957887E6 at goodlearning dot com> <a05300b25bcff8e2fb4db at [10 dot 10 dot 13 dot 3]>

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>

<Prev in Thread] Current Thread [Next in Thread>