# Platformer game screen is constantly moving down

**URL:** https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548
**Category:** Coding Questions
**Created:** [January 15, 2019, 5:54pm UTC](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548 "2019-01-15T17:54:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Timpupk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/timpupk/32/3257_2.png) [@Timpupk](https://discourse.processing.org/u/Timpupk)
#### Post date: [January 15, 2019, 5:54pm UTC](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548/1 "2019-01-15T17:54:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![HD161693](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@HD161693](https://discourse.processing.org/u/HD161693)
#### Post date: [January 15, 2019, 6:02pm UTC](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548/2 "2019-01-15T18:02:07Z")

</div>

line 111,

> `player.grounded = false;`

just needs commenting out

---

<div class="post-metadata">

### Author: ![BennyHacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bennyhacker/32/2969_2.png) [@BennyHacker](https://discourse.processing.org/u/BennyHacker)
#### Post date: [January 15, 2019, 6:44pm UTC](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548/3 "2019-01-15T18:44:19Z")

</div>

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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/38931f2deb6b66fdeaf7ceba5f1081658e6e43b7.png)
