Getter on layers width and heigth ?

Get help using Construct 2

Post » Thu Sep 06, 2012 4:48 pm

Is it possible de use a getter to access widths and heigths of layers ?

For example : On an event, I want to set X and Y positions to a sprite in the middle of a layer. Like :

sprite.X = layer("myLayer").width / 2
sprite.Y = layer("myLayer").height / 2

Is it possible to do that ?
B
40
S
9
G
5
Posts: 127
Reputation: 6,609

Post » Thu Sep 06, 2012 5:52 pm

ViewportRight("layer") - ViewportLeft("layer")
ViewportBottom("layer") - ViewportTop("layer")
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Sep 06, 2012 6:31 pm

It works ! Thank you :)
B
40
S
9
G
5
Posts: 127
Reputation: 6,609


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Scofano and 22 guests