2 different ways

Way one

  • background is constantly moving when the player is moving

  • put the speed at which the player is moving into a variable
  • manipulate this variable to the background to move at a slower speed then the player moves
  • background should move in the opposite direction as the player

Way two

  • background only moves when character reaches the side of the screen and is continuing to move

  • detect when the player reaches the side of the screen
  • put the player speed into a variable
  • manipulate this variable to the background to move at a slower speed then the player moves
  • background should move in the opposite direction as the player