Thanks everybody for their explanation. I am going to try to implement
the z-depth manager as discussed.
Jiri
Ian Thomas wrote:
Hi Jiri,
The key here is that you can have 'empty' depth levels i.e. an object at
depth 5 and an object at depth 8 with nothing at depth 6 and 7.
You can make the depth dependent on the actual pixel _y value of the
object rather than on the y value of the tile - so depth=_y (or more likely
depth=startDepth+_y, because you'll want things behind your objects - like
the tiles).
To handle multiple objects etc. - from memory, when I last did this I wrote
a depth manager that did something like:
- Reserve 100 'slots' per_ y-value (so you could have up to 100 objects
sharing the same vertical position)
- Assign a depth value that combines the y value with the first free slot
number - so (something like)
depth=startDepth+y*100+freeSlotNumberForThisYValue
That's not exact, but you get the idea. That way, generally you just need to
assign a depth to an object, you don't need to shuffle all the other objects
around.
IIRC, it worked rather well.
Hope that's helpful.
Ian
On 9/11/07, Jiri Heitlager <[EMAIL PROTECTED]> wrote:
He guys (and maybe girls),
I have a question that is related to z-depth managing in an isometric
game, that needs to be made in AS2.
In the game I basically use one abstract layer that holds all the tiles
and their information wheter or not a movable object is allowed to
'walk' over the tile. Then there is another layer that holds all the
objects, so that includes a player, a computer controlled player and
enviormental objects that players cannot walk through being the
visualization of the first layer.
Every object gets a z-depth assigned. For the players the zdpeth need to
be set based on the tile they are at. This way the players can walk
'around' the enviorment objects. For the z-depth calculation I use the
tile grid x and y plus the width of the row, this generates an unique
z-depth number and makes sure that the higher the y, the bigger the
z-depth , thus objects appear infront of objects with a lower y index.
Here is the problem I am trying to figure out. If two movable objects,
or even three of them are at the same time on the same tile, then the
above described z-depth managing will fail. How do I deal with that?
Then another question I have is this. Does every movable object needs to
check/swap z-depth on every frame. Wouldn't that be to CPU intensive?
I really hope someone can clear this up for me.
thank you in advance,
Jiri
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com