I'd rather not use a plist for this project - so I modified this code:
http://www.cocos2d-iphone.org/forum/topic/7855
Here's my revision:
CCSpriteBatchNode * spritesheet = [CCSpriteBatchNode batchNodeWithFile:@"page_1_anim_0.png"];
[self addChild:spritesheet];
for (int i = 0; i < 5; i++) {
int x = 0 + i;
int y = 0;
CCSpriteFrame* frame = [[CCSpriteFrame alloc] initWithTexture:spritesheet.texture rect:CGRectMake(x * 311, y * 0, 311, 311)];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFrame:frame name:[NSString stringWithFormat:@"playerFrame%d", i]];
[frame release];
}
CCSprite *sprite = [[CCSprite alloc] initWithSpriteFrameName:[NSString stringWithFormat:@"playerFrame%d", 0]];
[spritesheet addChild:sprite];
[sprite release];
[sprite setPosition:CGPointMake(400, 400)];
NSMutableArray* animFrames = [NSMutableArray array];
for (int i = 0; i < 5; i++) {
CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"playerFrame%d", i]];
[animFrames addObject:frame];
}
CCAnimation *animation = [CCAnimation animationWithFrames:animFrames];
[sprite runAction:[CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:animation restoreOriginalFrame:NO]]];
Unfortunately, the image sits on the first frame, and doesn't animate. Any ideas?