How do I make the camera follow the player only vertically?

Get help using Construct 2

Post » Fri Sep 12, 2014 8:17 pm

So i have this platform game, where the player jumps from one platform to another. What i want it is
the camera to follow him only vertically/up, when if falls the camera will remain in the same position and the player will fall outside of layout(doodle jump like). I tried a few things with scroll to behavior but i don't have to much control with that.
Maybe it's simple than it's looks but i spent hours trying things and doing research and i couldn't work it out.
B
4
Posts: 10
Reputation: 212

Post » Fri Sep 12, 2014 8:30 pm

you should to use the lerp() function instead the scroll behavior I guess, if for example you need to the camera follows onley the main player vartically, then you have to use something like that.

[code]+System: Every tick
->System: Scroll to lerp(ScrollY, Player.Y, dt) (only for vertically)
[code]+System: Every tick
->System: Scroll to lerp(ScrollX, Player.X, dt), (only for horizontally)
[code]+System: Every tick
->System: Scroll to lerp(ScrollX, Player.X, dt), lerp(ScrollY, Player.Y, dt)(both)
B
14
S
4
G
2
Posts: 109
Reputation: 2,679

Post » Sun Sep 14, 2014 12:59 pm

So i tried your method and it works but only partially. The camera still follows the player even when it falls from a platform,
and i want to freeze the camera somehow and only the player to fall.
Also the camera has a slow delay, when the player jumps high the camera remains behind to the point where i can not see the player anymore. Pls see Doodle jump to know what i want to achieve.
B
4
Posts: 10
Reputation: 212

Post » Sun Sep 14, 2014 1:36 pm

Add player not falling condition to one of the lerp actions and it will work fine.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

Post » Sun Sep 14, 2014 6:34 pm

ok, so try this

https://dl.dropboxusercontent.com/u/60873147/RE_FORUM/TEST.capx

and i want to freeze the camera somehow and only the player to fall.


when the player fall out you can freeze the scroll sprite
B
14
S
4
G
2
Posts: 109
Reputation: 2,679

Post » Mon Sep 15, 2014 1:22 pm

So i added not fallen condition, it works almost perfectly
camera follows the player when it jumps, but there is still an
issue. In the game there is a platform which throws the player really high and the camera remains behind so the player is outside the layout.
When the player falls down, the camera still follows a bit, but
that isn't much a problem since it gets outside of screen pretty quick.
B
4
Posts: 10
Reputation: 212

Post » Mon Sep 15, 2014 1:26 pm

I saw your example but i didn't manage to freeze the camera, is still following the player down even when it falls
B
4
Posts: 10
Reputation: 212

Post » Tue Nov 08, 2016 12:08 am

use the on collison event create an invisible block and do if camera collides with the invisible box then freeze
B
8
S
2
Posts: 5
Reputation: 600


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests