Running an a single action on multiple sprites at the same time

Posted by Stephen on Game Development See other posts from Game Development or by Stephen
Published on 2012-05-31T23:30:23Z Indexed on 2012/06/01 4:50 UTC
Read the original article Hit count: 402

Filed under:
|

Ok so I have created a spiraling animation for a football and I want to be able to run it on 2 sprites at the same time. This is what I have done.

CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f];
spiral = [CCAnimate actionWithAnimation:footballAnim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:spiral];
[Sprite1 runAction: repeat];
[Sprite2 runAction: repeat];

but it only runs the action on the first sprite. What am I doing wrong?

© Game Development or respective owner

Related posts about cocos2d-iphone

Related posts about cocos2d