Hi,
Thanks
I am using this example code, using an AtlasAnimation to create the frames, and then an animation action. How do I use this method, do I not use actions any more - or use both approaches. i.e. add the frames I want to manually switch to using AtlasSpriteFrames, run my animation action and then use a call back to advance to a specific AtlasSpriteFrame?
AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"grossini_dance_atlas.png" capacity:50];
[self addChild:mgr z:0 tag:kTagSpriteManager];
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
AtlasSprite *sprite2 = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
AtlasSprite *sprite3 = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
AtlasAnimation *animation = [AtlasAnimation animationWithName:@"dance" delay:0.2f];
for(int i=0;i< 14;i++) { // there are 14 images in this sprite sheet, each sprite is in a box 85 pixels wide and 121 pixels tall
int x= i % 5;
int y= i / 5;
[animation addFrameWithRect: CGRectMake(x*85, y*121, 85, 121) ];
}
[mgr addChild:sprite];
[mgr addChild:sprite2];
[mgr addChild:sprite3];
CGSize s = [[Director sharedDirector] winSize];
sprite.position = ccp( s.width /2, s.height/2);
sprite2.position = ccp( s.width /2 - 100, s.height/2);
sprite3.position = ccp( s.width /2 + 100, s.height/2);
id action = [Animate actionWithAnimation: animation];
id action2 = [[action copy] autorelease];
id action3 = [[action copy] autorelease];
sprite.scale = 0.5f;
sprite2.scale = 1.0f;
sprite3.scale = 1.5f;
[sprite runAction:action];
[sprite2 runAction:action2];
[sprite3 runAction:action3];