Hi I'm trying to create multiple animated characters from a for loop and I can't get it to work when I try to loop it. like so.
while(i <= 3)
{
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
[mgr addChild:sprite];
sprite.position = ccp( 100, 100);
id action = [RepeatForever actionWithAction:[Animate actionWithAnimation: animation]];
[sprite runAction:action];
}
Right now the only way i can do it is like this
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
[mgr addChild:sprite];
sprite.position = ccp( 100, 100);
id action = [RepeatForever actionWithAction:[Animate actionWithAnimation: animation]];
[sprite runAction:action];
AtlasSprite *spriteB = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 85, 121) spriteManager: mgr];
[mgr addChild:spriteB];
spriteB.position = ccp( 200, 100);
id actionB = [RepeatForever actionWithAction:[Animate actionWithAnimation: animation]];
[spriteB runAction:actionB];