Z-Ordering and ATL
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Fri Apr 19, 2013 4:04 am
Z-Ordering and ATL
I'm using ATL, and am getting the hang of it now (and really enjoying it). I am curious about the best way to handle z-ordering though. I have a character in my game, and I want to make sure that the drawing order is correct. I see how to draw the layers in different orders, but I don't see any way to gracefully handle drawing my characters and such at the right time. Anyone have any ideas or pointers?
Re: Z-Ordering and ATL
What's ATL? Anyway, I've written about this here.
The basic idea is to sort your objects list every frame according to some criteria. For a Zelda-like game (not top-down at a 90 angle) that criteria would be the y attribute of the object's position. For a platformer you could have an additional z attribute and then you sort it based on that, which is basically what you do when you use layers.
But yea, sort the objects such the ones that should appear in front of all others are at the back of the list and the ones that should appear behind everything are at the front. So that when you draw all objects going from front -> back they'll be drawn at the appropriate order.
The basic idea is to sort your objects list every frame according to some criteria. For a Zelda-like game (not top-down at a 90 angle) that criteria would be the y attribute of the object's position. For a platformer you could have an additional z attribute and then you sort it based on that, which is basically what you do when you use layers.
But yea, sort the objects such the ones that should appear in front of all others are at the back of the list and the ones that should appear behind everything are at the front. So that when you draw all objects going from front -> back they'll be drawn at the appropriate order.
-
- Prole
- Posts: 2
- Joined: Fri Apr 19, 2013 4:04 am
Re: Z-Ordering and ATL
https://github.com/Kadoba/Advanced-Tiled-Loader That is "ATL" I understand the concept of it. I'm just wanting to see if there is an elegant method for doing this.
Re: Z-Ordering and ATL
It depends on how you structure your maps. Layers will always be drawn all at once in order. But object layers can be converted into custom layers that can be drawn however you want, z-order included.
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 6 guests