title: CCSequence Firing Actions in Cocos2d
body: <p>I have three actions that are triggered in the <code>CCSequence</code>. The way I want it to be fired is that first the sprite should move in the center of the screen and then the scale action is fired. But for some reason the sprite moves to the center of the screen correctly but when the scale is fired it uses the old sprite position. </p>
  
  <pre><code>id actionRotate = [CCRotateBy actionWithDuration:0.6 angle:360]; 
          id disappear = [CCFadeTo actionWithDuration:.5 opacity:0]; 
          id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(removeAlphabetToFindFromView:)];
          id actionScale = [CCScaleBy actionWithDuration:0.6 scaleX:10 scaleY:10]; 
          id moveTo = [CCMoveTo actionWithDuration:0.6 position:ccp(windowSize.width/2, windowSize.height/2)]; 
  
  
          //[self removeAlphabetToFindFromView2:alphabetToFind]; 
  
          [alphabetToFind runAction:[CCSequence actions:moveTo,actionScale,disappear,actionMoveDone, nil]];
  </code></pre>
  
  <p><strong>UPDATE 1:</strong> </p>
  
  <p>Maybe the <code>startAnimation</code> method has something to do with this. I have public x and y variables which is used as x and y positions for 4 different sprites: </p>
  
  <pre><code>-(void) startAnimation:(CCSprite *) sprite
  {
  
      [self generateRandomCoordinates]; 
  
      id actionMove = [CCMoveTo actionWithDuration:3.0 position:ccp(x,y)];
      id actionRotate = [CCRotateBy actionWithDuration:0.0 angle:rotateBy]; 
  
      id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(finishedMoving:)]; 
  
      [sprite runAction:[CCSequence actions:actionMove,actionRotate, actionMoveDone, nil]];
  
  }
  
  -(void) finishedMoving:(id) sender
  {
  
      if(counter == randomAlphabets.count) 
      {
          counter = 0; 
      }
  
      CCSprite *sprite = [randomAlphabets objectAtIndex:counter]; 
  
      [self generateRandomCoordinates]; 
  
      [self startAnimation:sprite]; 
  
      counter +=1; 
  
  }
  </code></pre>
  
  <p><strong>UPDATE 2:</strong> </p>
  
  <p>As expected the x and y used in the startAnimation method (<code>getRandomCoordinates</code>) were causing the problem. So, I removed all the actions before firing the sequence and now it works fine. </p>