0 Favourites

Help with z-order position

  • Hi Everyone,

    I have 10 sprites all of the same size, and with the same X,Y position. I want to be able to push a button and bring the sprite at the bottom of the layer up to the top, and I'd like to be able to do this for all ten. I know sprites have a z-order on layers, but can't find a way to check on individual sprites z-order position. I was thinking I'd probably need to keep track of each sprites position using variables, but I'm not sure exactly how to do that.

    Can somebody let me know how I might achieve this?

    Thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You want all ten sprites bring to top layer at the same time, or one by one?

  • Hi shinkan,

    Thanks for your reply. I want to bring individual sprites to the top of the layer 1 at a time. So each time I press a button the sprite at the bottom of the pile comes to the top. Do you know how I could do that?

    Thanks

  • Sprite: Pick bottom instance -> Sprite move to layer 1

    This will pick the Sprite with lowest Zindex and move it to layer 1.

    If you have many different Sprites put them into a family and then

    Family: Pick bottom instance -> Family move to layer 1

  • Thanks shinkan.

    I think I may have explained my issue badly. All of the sprites are already on the same layer, and each sprite is different (so not many copies of one sprite).

    I want to be able to separately pick up each of the sprites with the mouse. The problem is, because they?re stacked directly on top of each other, I can only select the sprite at the top of the stack. That's why I need a way to push a button and change the sprites z-order, so that I can make an individual sprite come to the top of the stack. Can using families help me with this?

    Thanks again for your help.

  • Okay I've set up a family and I can now easily bring bottom sprite to top of the stack, thank you shinkan.

  • Alright then. If you need some more help just ask.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
157 12,695
megatronx's avatar
megatronx
Unread hot topic
0 Favourites
Kiira will help! :D
132 16,620
Kiira's avatar
Kiira
Unread hot topic
80 7,182
jobel's avatar
jobel