Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously.

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];

However, the action is only run on the first sprite. What am I doing wrong?

share|improve this question

Actions (sadly) can't be re-used or run multiple times. Instead you'll have to instantiate two actions or copy an existing one.

Something like this should work:

[Sprite1 runAction: [repeat copy]];
[Sprite2 runAction: repeat];
share|improve this answer
thanks you save my night i got idea from this pointer->runAction(rep->clone()); knifeHand->runAction(rep); – truq Mar 30 at 21:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.