How do I appear in front of another object

Get help using Construct 2

Post » Wed Jun 20, 2012 3:19 am

Making a platformer and this tree is in front of my player every time I walk by it. Both are on the same layer. How do I get the player in front of it?
B
23
S
6
G
3
Posts: 122
Reputation: 2,922

Post » Wed Jun 20, 2012 3:47 am

sorry i 've answered but the way scirra disconnect users from this forum is very frustrating because we always loose all text we have written !

So again considering "player" is the player sprite ...
1) in the layer select the player sprite (left click) and (then right click) -> Z-order move to top of layer ...
2) in code "player : move to top of layer"

You should have to use 2) if the tree is a object create by code in this layer or move to this layer using code because doing that it is always display in front of all others existing objects in this layer.naelian2012-06-20 03:51:14
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Wed Jun 20, 2012 4:43 am

Thanks naelin!

I used the first example and it worked perfectly!

Thanks again.
B
23
S
6
G
3
Posts: 122
Reputation: 2,922

Post » Wed Jun 20, 2012 6:53 pm

incase your wondering how it happened... you probably put the tree in the layout after the player object. Objects are ordered on Z in the order they were created

To make sure your player is always "on top" of everything else on the same layer move the player object to the top of the Z order every tick
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Thu Jun 21, 2012 2:59 am

Thanks aridale, I'll keep that in mind.
B
23
S
6
G
3
Posts: 122
Reputation: 2,922


Return to How do I....?

Who is online

Users browsing this forum: CrudeWall, MrLOL64 and 20 guests