title: Sprite kit game lags when nodes first appear on screen and move up the screen
body: <p>In my sprite kit game, nodes are endlessly moving up the screen, however, when they first appear on the screen the game lags and the fps fluctuates. After several seconds the nodes start to move smoothly, however, at times their movement is still fidgety. I believe that there is a problem with my update methods, however I am unsure of how to structure them in a better way. Below are my update methods. Any help will be much appreciated, thanks in advance</p>
  
  <pre><code>    - (void)updateWithTimeSinceLastUpdate:(CFTimeInterval)timeSinceLast {
  
  self.lastSpawnTimeInterval += timeSinceLast;
  if (self.lastSpawnTimeInterval &gt;= increment) {
      self.lastSpawnTimeInterval = 0;
  
  
  
      int randomNumber = arc4random_uniform(24);
  
      switch (randomNumber) {
          case 1:
              [self addChild: [self obstacle1]];
              [self addChild: [self obstacle5]];
              break;
          case 2:
              [self addChild: [self obstacle1]];
              [self addChild: [self obstacle6]];
  
              break;
          case 3:
              [self addChild: [self obstacle1]];
              [self addChild: [self obstacle7]];
              break;
          case 4:
              [self addChild: [self obstacle1]];
              [self addChild: [self obstacle8]];
              break;
          case 5:
              [self addChild: [self obstacle2]];
              [self addChild: [self obstacle5]];
              break;
          case 6:
              [self addChild: [self obstacle2]];
              [self addChild: [self obstacle6]];
  
              break;
          case 7:
              [self addChild: [self obstacle2]];
              [self addChild: [self obstacle7]];
              break;
          case 8:
              [self addChild: [self obstacle2]];
              [self addChild: [self obstacle8]];
              break;
          case 9:
              [self addChild: [self obstacle3]];
              [self addChild: [self obstacle5]];
              break;
          case 10:
              [self addChild: [self obstacle3]];
              [self addChild: [self obstacle6]];
  
              break;
          case 11:
              [self addChild: [self obstacle3]];
              [self addChild: [self obstacle7]];
              break;
          case 12:
              [self addChild: [self obstacle3]];
              [self addChild: [self obstacle8]];
              break;
          case 13:
              [self addChild: [self obstacle4]];
              [self addChild: [self obstacle5]];
              break;
          case 14:
              [self addChild: [self obstacle4]];
              [self addChild: [self obstacle6]];
  
              break;
          case 15:
              [self addChild: [self obstacle4]];
              [self addChild: [self obstacle7]];
              break;
          case 16:
              [self addChild: [self obstacle1]];
  
              break;
          case 17:
              [self addChild: [self obstacle2]];
  
              break;
          case 18:
              [self addChild: [self obstacle3]];
  
              break;
          case 19:
              [self addChild: [self obstacle4]];
  
              break;
          case 20:
              [self addChild: [self obstacle5]];
  
              break;
          case 21:
              [self addChild: [self obstacle6]];
  
              break;
          case 22:
              [self addChild: [self obstacle7]];
  
              break;
          case 23:
              [self addChild: [self obstacle8]];
  
              break;
          default:
              [self addChild: [self obstacle4]];
              [self addChild: [self obstacle8]];
              break;
      }
  }
  }
  - (void)update:(NSTimeInterval)currentTime {
  // Handle time delta.
  // If we drop below 60fps, we still want everything to move the same distance.
  CFTimeInterval timeSinceLast = currentTime - self.lastUpdateTimeInterval;
  self.lastUpdateTimeInterval = currentTime;
  if (timeSinceLast &gt;= 1) { // more than a second since last update
      timeSinceLast = 1 / 60.0;
      self.lastUpdateTimeInterval = currentTime;
  }
  
  [self updateWithTimeSinceLastUpdate:timeSinceLast];
  
  }
  </code></pre>
  
  <p>The increment integer I have implemented varies between 1.0 and 1.9 and gradually decreases as game continues.</p>
  
  <p>Below is one of my obstacle methods. All obstacle methods are relatively similar. The only differences are position and image.</p>
  
  <pre><code>- (SKSpriteNode *)obstacle1 {
  
  int placement[6] = {0, 50, 100, 150, 200, 250};
  int RandomPlacement = placement[(arc4random()%6)];
  
  NSArray *obstacle1Images;
  
  SKSpriteNode *obstacle1Node;
  
      obstacle1Node = [SKSpriteNode spriteNodeWithImageNamed:@"dodgR - spike left iPad.png"];
      obstacle1Node.position = CGPointMake(CGRectGetMidX(self.frame) - 321.5, CGRectGetMidY(self.frame)-self.frame.size.width/2 - RandomPlacement);
      obstacle1Node.size = CGSizeMake(292, 95);
  
     obstacle1Images = @[[SKTexture textureWithImageNamed:@"dodgR - spike left iPad.png"],
                                   [SKTexture textureWithImageNamed:@"dodgR - spike left iPad; 1.png"],
                                   [SKTexture textureWithImageNamed:@"dodgR - spike left iPad; 2.png"],
                                   [SKTexture textureWithImageNamed:@"dodgR - spike left iPad; 3.png"],
                                   ];
      SKAction *obstacle1Animation = [SKAction animateWithTextures:obstacle1Images timePerFrame:0.2];
  
      SKAction *obstacle1Repeat = [SKAction repeatActionForever:obstacle1Animation];
  
      [obstacle1Node runAction:obstacle1Repeat];
  
  
  SKNode *person1 = [self childNodeWithName:@"person1"];
  
  if (person1.position.y &gt; obstacle1Node.position.y) {
      [self ScoreTing];
  }
  </code></pre>