First off, thanks that you people took the time to help me out and thank
you Jobe for sending me your class. I appreciate that, but would really
like to program the game myself from scratch to get a full understanding
on how games like this are made.
I am reading all the replies and trying to see if I am understand them
correctly.
Basically I have two options. Give every movable object the depth of the
screen _y value and make sure that objects can never be on the same _y
position.
Second option. If the movable objects only move one tile at a time,
meaning that their screen _y position could sometimes be the same, I
need to assign for every tile a range of n numbers of depth that can be
taken. Then check for an available depth within each tiles indivudual
range of depth , when a movable objects is on a tile.
@Danny, could please explain your comment on subsorting a bit more. I am
not quit sure if I understand it.
> However, you can optimise quite a bit
> by sub-sorting - if you know that object 1 is in the rear 16 tiles and
> object 2 is in the front 16 tiles, no need to check the z-order.
Jiri
Danny Kodicek wrote:
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?
If this is possible in your game then you'll need to either store sub-tile
positions and z-sort further on those (you could, for example, assign ten
z-slots per tile to ensure that you have more space) or randomly choose one
to be in front of the other (if there's only one position per tile, then it
doesn't matter which one gets drawn in front).
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?
Depends how you do it. If there's only a few movable objects, this shouldn't
be particularly hard on the machine - Flash isn't the fastest thing in the
world, but it's fast enough for that. However, you can optimise quite a bit
by sub-sorting - if you know that object 1 is in the rear 16 tiles and
object 2 is in the front 16 tiles, no need to check the z-order.
Danny
_______________________________________________
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