- Select manual -

Z-order

This example shows how to put one sprite in front of another

z order

There is one game object containing the background sprite. It is set at Z position 0. The bunny is another game object containing a sprite. The bunny game object is at Z position 1.

z_order.script

function init(self)
    go.animate(".", "position.x", go.PLAYBACK_LOOP_PINGPONG, 600, go.EASING_INOUTSINE, 3) 
end
  1. Animate the game object’s ("." is shorthand for the current game object) x position between start position and 600.

If you want to play with these examples, you can get the project on Github.

Do you want to see more examples? Why not write a few yourself and submit a pull request? We love contributions.

Contribute