# Parallax background speeds change when moving sprite

**URL:** <https://phaser.discourse.group/t/parallax-background-speeds-change-when-moving-sprite/5320>\
**Category:** Phaser 3\
**Created:** [February 24, 2020, 6:18pm UTC](https://phaser.discourse.group/t/parallax-background-speeds-change-when-moving-sprite/5320 "2020-02-24T18:18:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmb272](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jmb272](https://phaser.discourse.group/u/jmb272)\
**Post date:** [February 24, 2020, 6:18pm UTC](https://phaser.discourse.group/t/parallax-background-speeds-change-when-moving-sprite/5320/1 "2020-02-24T18:18:56Z")

</div>

I’ve got a project setup with a canvas size of 640x480.

I’ve setup a simple parallax background effect composed of two images setup as tile sprites.

I’ve also added a sprite that can be moved with the cursor keys.

The problem is that after a few moments of moving the sprite in any direction, the parallax effect speeds up before slowing down again when the sprite approaches the other side. I want the effect to be a consistent speed.

What causes this issue and how can it be fixed?

Thanks.

Here is my update function code for the parallax bg effect.

```javascript

if (this.cursors.left.isDown) {
  this.background.tilePositionX -= 1;
  this.midground.tilePositionX -= 2;
} else if (this.cursors.right.isDown) {
  this.background.tilePositionX += 1;
  this.midground.tilePositionX += 2;
}

if (this.cursors.up.isDown) {
  this.background.tilePositionY -= 1;
  this.midground.tilePositionY -= 2;
} else if (this.cursors.down.isDown) {
  this.background.tilePositionY += 1;
  this.midground.tilePositionY += 2;
}
```
