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
10
S
2
Posts: 7
Reputation: 632

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
123
S
43
G
41
Posts: 846
Reputation: 28,204

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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455


Return to Construct 2 General

Who is online

Users browsing this forum: Unconnected and 8 guests