Z-Ordering and ATL

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
joseph.brower
Prole
Posts: 2
Joined: Fri Apr 19, 2013 4:04 am

Z-Ordering and ATL

Post by joseph.brower »

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?
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: Z-Ordering and ATL

Post by adnzzzzZ »

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.
joseph.brower
Prole
Posts: 2
Joined: Fri Apr 19, 2013 4:04 am

Re: Z-Ordering and ATL

Post by joseph.brower »

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.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Z-Ordering and ATL

Post by Kadoba »

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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 193 guests