Help with z-order position

Get help using Construct 2

Post » Fri Sep 14, 2012 2:03 pm

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
B
4
Posts: 7
Reputation: 442

Post » Fri Sep 14, 2012 2:15 pm

You want all ten sprites bring to top layer at the same time, or one by one?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 14, 2012 2:25 pm

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
B
4
Posts: 7
Reputation: 442

Post » Fri Sep 14, 2012 2:33 pm

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
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 14, 2012 3:01 pm

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 theyre 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.
B
4
Posts: 7
Reputation: 442

Post » Fri Sep 14, 2012 3:31 pm

Okay I've set up a family and I can now easily bring bottom sprite to top of the stack, thank you @shinkan.
B
4
Posts: 7
Reputation: 442

Post » Fri Sep 14, 2012 6:26 pm

Alright then. If you need some more help just ask.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests