Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: milkanannan on Mon 04/04/2005 04:25:52

Title: Object z-order in editor
Post by: milkanannan on Mon 04/04/2005 04:25:52
Hello - I've searched the forums to no avail - is there anyway to change how objects are layered (i.e. object A is behind object B)?  I have had to resort to delete objects then re-adding them in the order I want but there must be an easier way - any advice?

Thanks
Title: Re: Object Layers
Post by: strazer on Mon 04/04/2005 05:29:12
I don't think you can change the z-order display of objects in the editor.

If you're talking about run-time, it's all in the baselines:

If object A's baseline is further down than the baseline of object/character B, object A is drawn in front of B.
By default, character and object baselines are at their coordinates, the bottom of the sprite.

So if object A is positioned below object B, A is drawn in front of B.
Now, if you want object A to be drawn behind object B, you can simply re-position the objects so object A's bottom is above object B's bottom or set a new baseline for object A ("Set baseline" button) and place it above object B's bottom or set a new baseline for object B and place it below object A's bottom. Or set a new baseline for both and make sure object A's new baseline is above object B's new baseline.

But keep in mind that the baselines also affect how characters are drawn. The same principle applies: If the character's baseline (also bottom by default) is below object A's baseline, he is drawn in front. If it's above object A's baseline, he is drawn behind it.
Just play around a bit and find out what works best for your situation.
Title: Re: Object Layers
Post by: Radiant on Mon 04/04/2005 10:22:46
Yep. In the editor the highest-numbered object is always on top. In the game, not so, as strazer explained.
Title: Re: Object z-order in editor
Post by: spaceship789 on Wed 24/10/2007 21:50:50
What is the in-game draw order for characters that are at the same position?

I have a whole lot of characters at the same position, and most of them appear in the same order as they are in the character list, but there will be an occasional maverick character which jumps right to the front and I'm not sure why.

I expect there the characters are not drawn in random order - even if it is a strange answer, I would like to hear it.
Title: Re: Object z-order in editor
Post by: spaceship789 on Mon 01/09/2008 06:11:40
I am still very interested in the answer to this question.

(If someone were to provide an answer, I could share some executable test levels of my game. I have been working hard, and many graphics and three test levels. Cheers!)
Title: Re: Object z-order in editor
Post by: Pumaman on Mon 01/09/2008 19:15:31
If two objects/characters have the same baseline, the order in which they will be drawn is undefined.

That means that AGS makes no promises either way. If you want to make sure one is drawn in front of the other, make sure they have different baselines.
Title: Re: Object z-order in editor
Post by: spaceship789 on Wed 03/09/2008 08:36:26
It might be a good thing to have that order defined. Especially for comatibility on other engines, eg mac, or maybe XNA. Might be a good thing to put in the engine specification.

I have had a play over the last few days and it seems to be that the 'last one edited' is shown on top. I have been able to use this to resolve my drawing problem right now.

Thanks for the reply Pumaman :)