Platformer game screen is constantly moving down

The screen is constantly moving down anybody see any way to fix it?
https://editor.p5js.org/Timpupk/sketches/Hy1vHJFy4

line 111,

player.grounded = false;

just needs commenting out

It seems one of the main issues is that you use a separate variable to control the scrolling.
By doing this, you run the risk of this variable not being ‘in sync’ with the player
One solution is using the player’s actual position to control the scrolling, and getting rid of the scroll variables

Another solution is making sure the exact amount of movement applied to the player is the same as the scroll. I’ll try to demonstrate with a picture:

example3

2 Likes