How do I control the Z order during gameplay?

  • Is there a way to manually set the Z-order of the objects in the game? The only option is to send to the top or bottom? I would like to control intermediate positions in the Z order with the player's actions.

    I am using the plugin Rexrainbow, Me helps a lot, but does all the work for me, I would like to know how to control each position of objects during game play.with the plugin Rex, I can sort the enemies and the player perfectly, but when the hero hit an enemy positioned a layer above the player in order Z, I want the enemy to move a layer behind the player, and not go to last position in the Z order of the layout.

  • Quite simple actually, just use the "Move to Layer" function, and it'll work just fine

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if the layout has 10 enemies, I will have to create 10 layers to power he commands them? if you need more objects has not adding layers during game play, but it is possible to modify the Z-order

    my doubt is to move objects one level above or below, however the construct 2 only me of the options top or bottom. Expected something of type Set Z >> self Z +2 for example

  • I don't know if there is a function for that, but you can can try this.

    Add a variable to the objects you want to move around to keep the value of the layer he is in.

    Every time you update this value, like self z + 2, you will move the character to the layer you want depending on the value you get.

    If char Z = 2, move to layer 2. Something like that

  • I see something that may be what you are looking for...

    Move to object

    Move the object next to another object in the Z order. You can choose to place the object to be placed in front or behind another object. If the target object is on a different layer, the object will also be moved to the target object's layer and then Z ordered next to it.

    It is under the zorder actions, maybe it is a limitation on the plugin.

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