Animated sprite with sprite in Cocos2d 3.0
Be sure to add #import "CCAnimation.h"at the beginning of your code
Also add a sprite sheet after self.userInteractionEnabled = YES; in init
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"your.plist"];
Do not add all this where the sprite will be
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i <= 7; ++i)
{
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"monster%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation
animationWithSpriteFrames:walkAnimFrames delay:0.1f];
monstertest = [CCSprite spriteWithImageNamed:@"monster1.png"];
monstertest.position = ccp(self.contentSize.width/2,self.contentSize.height/2);
CCActionAnimate *animationAction = [CCActionAnimate actionWithAnimation:walkAnim];
CCActionRepeatForever *repeatingAnimation = [CCActionRepeatForever actionWithAction:animationAction];
[monstertest runAction:repeatingAnimation];
[self addChild:monstertest];
Hope this helps someone: D Cheers