Get Z Order


The Get Z Order behavior returns the current Z-Order index for the selected object. This will return a numerical value relating to the position in front of or behind another object on your layer. You can learn more about Z Orders from the Layers documentation.

This behavior will Trigger an event immediately.



Triggers Immediately

Object A

This is the object that will return its Z Order Index. By default the current object is selected, but you can tap the graphic and choose any other object in your scene.



Z Order

The Z-Index/Z-Order of the object. A higher number brings the object closer to the surface of the screen and the object will appear on top of other objects with a lower z index. A Lower number will push the object further into the screen, and behind objects with a higher z-order.

Object ID

This outputs the Object ID.



If you're creating a forest and need to know if a tree/bush is in front or behind your character you can use this behavior to get the z-order. Once you know the order, you can then use Set Z Order to move the character accordingly.

Download Example Project



Set Z Order




Article is closed for comments.