Parallax Formula

Discussion and feedback on Construct 2

Post » Wed Apr 27, 2016 9:27 pm

Hi, I'm making a platform game and I'm using lots of layers so I can give them different parallax.
But if I wanted to put all those backgrounds into one layer and make them parallax with an event, what would the formula be? (Probably would have to use some instance variables like originalX, originalY, ParallaxX and ParallaxY).
Thanks.
B
12
S
3
Posts: 7
Reputation: 782

Post » Thu Apr 28, 2016 5:50 am

You can use LayerToCanvas and CanvasToLayer to convert the position between layers.

https://www.scirra.com/tutorials/1167/l ... er-example
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Thu Apr 28, 2016 7:10 am

Something like (Scrollx-originalx)*0.5 for horizontal parallax. Vertical is similar. Replace 0.5 with the whatever rate you want.
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273


Return to Construct 2 General

Who is online

Users browsing this forum: Animmaniac, tumira and 13 guests