title: How to make a background scroll left
body: <p>I am making a game written in <code>Objective-C</code> and <code>SpriteKit</code> where the player can scroll the background either from the right to the left or from the left to the right. </p>
  
  <p>Currently I have figured out how to write the code to make the background scroll right when the user swipes, but not how to make it scroll to the left. </p>
  
  <p>So, my question is how do I make it scroll to the left? Here is the code:</p>
  
  <p><code>Sprites</code>:</p>
  
  <pre><code>  bg1 = [SKSpriteNode spriteNodeWithImageNamed:@"bg1"];
    bg1.anchorPoint = CGPointZero;
    bg1.position = CGPointMake(0, 0);
    [self addChild:bg1];
  
    bg2 = [SKSpriteNode spriteNodeWithImageNamed:@"bg2"];
    bg2.anchorPoint = CGPointZero;
    bg2.position = CGPointMake(bg1.size.width-1, 0);
    [self addChild:bg2];
  
  //Update Method:
  
  bg1.position = CGPointMake(bg1.position.x-4, bg1.position.y);
  bg2.position = CGPointMake(bg2.position.x-4, bg2.position.y);
  
  if (bg1.position.x &lt; -bg1.size.width){
      bg1.position = CGPointMake(bg2.position.x + bg2.size.width,  bg1.position.y);
  }
  
  if (bg2.position.x &lt; -bg2.size.width) {
      bg2.position = CGPointMake(bg1.position.x + bg1.size.width, bg2.position.y);
  }
  </code></pre>