How do I limit camera's Y when the player jumps (scrollY)

Get help using Construct 2

Post » Mon May 22, 2017 5:32 pm

I'm using the system scroll to smooth scroll as the player moves. The horizontal movement of the camera is flawless.

The problem is when the player jumps the camera jumps with it which is a bit jarring. I can't disable the scrolly because the platforms are laid in various levels across the Y axis and the camera should follow the player when the Y position changes significantly.

I've seen a few games where the camera doesn't move vertically when the player jumps but follows as the player moves up and down the y-axis.

Is there any way to do both smooth scrolling and limiting the camera's Y movement when the player jumps but letting it move as the player moves up and down.

I hope I'm making this clear.
B
26
S
1
Posts: 59
Reputation: 1,100

Post » Mon May 22, 2017 6:12 pm

You put the scrollto on an invisible dummy sprite and use that as your 'camera' instead. Just update the dummy sprites x position to match the players.
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,334

Post » Tue May 23, 2017 4:36 pm

I tried this and it stabilizes the camera but I still need the camera to move in the Y axis as the player moves around the layout, just not when its merely jumping (unless jumping on a ledge or a higher level platform).

Image

I've been using the second line code.
B
26
S
1
Posts: 59
Reputation: 1,100

Post » Tue May 23, 2017 8:29 pm

Just update the dummy sprite with some Y position logic when you need it to follow the player vertically as well as horizontally. You might be able find some 'follow camera' tutorials that go into greater detail.
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,334


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests