I've recently started using Cocos2d, and I decided to install the 0.9 beta. Unfortunately there is very little how-to documentation for the new API revisions, and I don't have experience with the older versions to use as a frame of reference. I've spend a half a day trying to solve this.
I have a CCSprite, which is part of a CCSpriteSheet (created from CCSpriteSheet::createSpriteWithRect). I can get this working and displayed just fine. But now I want to create a CCAnimation consisting of 2 frames from the CCSpriteSheet, and add this to my CCSprite, and set this as the currently-running animation, repeating forever. (I also want to speed up and slow down this animation at will, but first things first.)
I've created a CCAnimation and added 2 CCSpriteFrames via CCAnimation::addFrameWithTexture:rect, and added this to my CCSprite object. Now I would expect there to be some intuitive method on CCSprite called "setCurrentAnimation" or "setAnimation" or "startAnimation:name" or anything of this sort. I would also expect a way to specify a separate delay for each frame of the animation, and then be able to scale the entire CCAnimation by some factor which would affect all of these. But I don't see any of this.
I see the CCSprite:runAction method and I've fiddled with this for quite a while with no success. I think the key lies here somewhere. Can someone please assist me with some sample code that demonstrates how to accomplish my task? (to reiterate, I just want an endlessly-looping 2-frame animation of a sprite that has a sprite sheet as a basis).