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
15
S
3
Posts: 7
Reputation: 857

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
131
S
45
G
41
Posts: 860
Reputation: 28,641

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
100
S
38
G
134
Posts: 5,556
Reputation: 85,325


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests