I want to play an sequence of png files for animation. I tried executing the following code in cocos2d iphone
-(void) onEnter {
[super onEnter];
roadSprite=[[Sprite spriteWithFile:@"R00.png"] retain];
[roadSprite setPosition:ccp(240,160)];
[self addChild:roadSprite z:5];
Animation* animation = [Animation animationWithName:@"animation" delay:0];
for( int i=0;i<25;i++)
{
[animation addFrameWithFilename: [NSString stringWithFormat:@"R%02d.png", i]];
}
id action1 = [Animate actionWithAnimation: animation];
[roadSprite runAction:action1];
}
The animation doesnt get played instead the R00.png gets displayed lastly. Can anyone help me to find the mistake.