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
373
S
218
G
84
Posts: 23,563
Reputation: 186,428

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: abj84, Benhh, JMKit, qroft and 9 guests