How do I use Z-Order correctly

0 favourites
  • 5 posts
  • Hi everybody,

    Just a quick question about Z-Order.. Initially I use the Z-order bar to order my sprites on the layout. When I destroy a sprite, and create a new version of it, it does not use the same defined Z-Order but it appears on top of the other sprit(s).. Is this normal behaviour?

    Do I have to z-order my new create objects manually every time?

  • Newly created objects land in front of all the other objects on the same layer. All objects on layers above the spawn-layer show in front. Z-order is the order of objects on a specific layer. But also the layers have a (kinda) Z-order. Layer on top shows in front.

    So, first, you got to create them on the right layer. The create action will ask you the layer. And that layer has to be on the right place in the layers list.

    Secondly, if you want the newly created object behind an existing object, then yes you have to adjust the Z-order. But that is only possible for objects on the same layer.

  • Newly created objects land in front of all the other objects on the same layer. All objects on layers above the spawn-layer show in front. Z-order is the order of objects on a specific layer. But also the layers have a (kinda) Z-order. Layer on top shows in front.

    So, first, you got to create them on the right layer. The create action will ask you the layer. And that layer has to be on the right place in the layers list.

    Secondly, if you want the newly created object behind an existing object, then yes you have to adjust the Z-order. But that is only possible for objects on the same layer.

    Thanks, this means my assumption was correct. I wonder if the new command 'Sort z order' can be of some use here

  • You have the bring in front/back in the sprite actions. They might be easyer.

    For the system Z-order action, you need to give instances an instance variable, and give each a value. Z-order will sort depending on that value. Hence, it only orders instances. Newly created objects need a value givven to that instance variable.

    Unless you have access to families. Then you can use a familie variable to sort.

    Renember that you can not read from a newly created object until the next top-level-event. Meanig, you can NOT use the sort action in the same sub level as the creation action.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you all for the answers, they where very helpful to me

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)