I am creating animation in sprite.I am changing sprite after perticular period and repeating it forever.I have referred many site and the format is same as below:
-(id) init
{
if( (self=[super init] ))
{
CCSpriteSheet *spriteSheet = [CCSpriteSheet spriteSheetWithFile:@"apls.png" capacity:3];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"apls.plist"];
CCSprite *sprite = [CCSprite spriteWithSpriteFrameName:@"apple2.png"];
sprite.position = ccp(230,230);
[spriteSheet addChild:sprite];
[self addChild:spriteSheet];
NSMutableArray *animFrames = [NSMutableArray array];
for(int i = 2; i < 5; i++)
{
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName: [NSString stringWithFormat:@"apple%d.png",i]];
[animFrames addObject:frame];
}
CCAnimation *animation = [CCAnimation animationWithName:@"dance"
delay:0.2f frames:animFrames];
[sprite runAction:[CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:animation restoreOriginalFrame:NO] ]];
}
return self;
}
this is the code for the same. But on simulator it is not showing anything. just frame rate keeps on changing.
Is there something which I am missing?
thanks in advance.