title: cocos2d dynamically changing animation speed with CCSpeed
body: <p>In a simple game, a character has a walking animation of around 15 frames. Based on the accelerometer is speed in either direction changes. I wanted the animation to speed up or slow down accordingly. I realize that once the animation is initialized, you can't change the delay speed, and instead you need to create a new animation. But since the speed changes almost constantly, if I kept reseting the animation, it would always be stuck on the same frame.</p>
  
  <p><strong>Is there a way to find which frame an animation is currently in, stop it, then create a new animation with the same frame but starts at which the last animation ended?</strong> </p>
  
  <p>Otherwise does anybody have an idea of how you could go about implementing a dynamically changing animation delay time?</p>
  
  <p>EDIT:</p>
  
  <p>I have tried using CCSpeed to do this from an example in Learn Cocos2d 2. Here is the code:</p>
  
  <pre><code>CCRepeatForever *walkLeftRepeat = [CCRepeatForever actionWithAction:[CCAnimation animationWithSpriteFrames:walkLeftFrames]];
  
  self.walkLeft = [CCSpeed actionWithAction:walkLeftRepeat speed:animationWalkingSpeed];
  </code></pre>
  
  <p>I get the following warning: Incompatible pointer types sending 'CCRepeatForever *' to parameter of type 'CCActionInterval *'</p>
  
  <p>Here is the example I am following from: </p>
  
  <pre><code>CCRepeatForever* repeat = [CCRepeatForever actionWithAction:rotateBy];
  CCSpeed* speedAction = [CCSpeed actionWithAction:repeat speed:0.5f];
  </code></pre>
  
  <p>Second EDIT:</p>
  
  <p>Then I tried this: </p>
  
  <pre><code>CCAnimation *walkLeftRepeat = [CCAnimation animationWithSpriteFrames:walkLeftFrames];
  CCAnimate *temp = [CCAnimate actionWithAnimation:walkLeftRepeat];
  CCAnimate*temp2 = [CCRepeatForever actionWithAction:temp];
  self.walkLeft = [CCSpeed actionWithAction:temp2 speed:animationWalkingSpeed];
  [_guy runAction:_walkLeft];
  </code></pre>
  
  <p>Final edit. This problem of it not showing up was fixed by adding a delay to ccanimation. </p>
  
  <p>This doesn't give any error's but nothing happens. 
  Thanks!</p>