My animation displays correctly, I'm running it once. The problem is after it runs it leaves the image of the first frame behind. How do I clean this up. I've tried [mgr removeChild:sprite cleanup:YES]; , but then the animation doesn't run.
Thanks for help.
AtlasSpriteManager* mgr = [AtlasSpriteManager spriteManagerWithFile:@"animBubble.png"];
[self addChild:mgr z:3];
CGRect rect = CGRectMake(0, 0, 46, 46);
AtlasSprite* sprite = [[AtlasSprite alloc] initWithRect:rect spriteManager:mgr];
[mgr addChild:sprite z:3];
AtlasAnimation* animation = [AtlasAnimation animationWithName:@"anim" delay: 0.08f];
int numFrames = 4;
for(int i = 0; i < numFrames; i++)
{
int x = rect.origin.x + (i * rect.size.width);
[animation addFrameWithRect:CGRectMake(x, rect.origin.y, rect.size.width, rect.size.height)];
}
id action = [Animate actionWithAnimation:animation];
[action setTag:8];
sprite.position = ccp(currentTile.position.x,currentTile.position.y);
[sprite runAction:action];