Set Z Order


The Set Z Order behavior will move your selected object in front or behind an object on the same layer. Objects with higher z-order (Z-index) will appear on top and objects with a lower z order will appear behind. 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 be moved forward or backward. By default the current object is selected, but you can tap the graphic and choose any other object in your scene.

Z Order

This is the position of your object on the Z axis. 

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 want your object to appear behind another object, but still be bale to collide with it you can change the Z Order to a number that is less than the object you want to appear in front.

Additionally, this behavior can be used to manipulate touches. If you change the z order so that another object is on top of the selected object, the other object will cause the selected object to no longer be touchable.

Download Example Project



Get Z Order




Article is closed for comments.