Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7596705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:58:57+00:00 2026-05-30T21:58:57+00:00

So the issue here is when I create one animated projectile, everything is fine.

  • 0

So the issue here is when I create one animated projectile, everything is fine. As soon as the user creates a second, the first stops animating.

Alright, here’s how I’m setting it up in my init:

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
     @"acorns.plist"];

CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode 
                                      batchNodeWithFile:@"acorns.png"];
[self addChild:spriteSheet];

NSMutableArray *flyingFrames = [NSMutableArray array];
    for(int i = 1; i <= 4; ++i) {
        [flyingFrames addObject:
         [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
          [NSString stringWithFormat:@"acorn%d.png", i]]];
    }

CCAnimation *flying = [CCAnimation 
                                 animationWithFrames:flyingFrames delay:0.5f];

self.flying = [CCRepeatForever actionWithAction:
                   [CCAnimate actionWithAnimation:flying restoreOriginalFrame:NO]];

Then, in my create bullets method which is called when the user taps the screen, I do:

CCSprite *bullet = [CCSprite spriteWithSpriteFrameName:@"acorn1.png"];
bullet.position = CGPointMake(140.0f, FLOOR_HEIGHT+145.0f);
[bullet runAction:_flying];

[self addChild:bullet z:9];
[bullets addObject:bullet];

So the first time the user taps, everything works fine. The second time, an animated bullet is created, but the existing one stops animating, and so on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:58:59+00:00Added an answer on May 30, 2026 at 9:58 pm

    I believe each sprite should have its own actions, ie you cant reuse an action while the action is in progress. Something like:

    CCSprite *bullet = [CCSprite spriteWithSpriteFrameName:@"acorn1.png"];
    bullet.position = CGPointMake(140.0f, FLOOR_HEIGHT+145.0f);
    id _fly=[CCAnimation animationWithFrames:flyingFrames delay:0.5f];
    id _flyForever = [[CCRepeatForever _fly];
    [bullet runAction:_flyForever];
    [self addChild:bullet z:9];
    [bullets addObject:buller];
    

    The flyingFrames can be referenced by multiple animations, so you must take care of retaining the array for reuse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my issue, I'd like to mock a class that creates a thread at
Having an issue here that I have tried everything I can think of but
Sample: I've created a minimal set of files that highlight the issue here: http://uploads.omega.org.uk/Foo3.zip
My issue here is quite simple : i'm trying to use the jQuery validate
I have a curious issue here In my ejbCreate() method from where i insert
I'm having an issue here, I am trying to get all the titles from
I've a small issue here. I am using an if statement with UIAlertView and
I have a rather annoying issue here I can't get my CheckBox CheckedChange event
I'm having a small issue here: <div id=navbar> <ul id=navtabs class=floatcontainer> <li <?php if
Hey guys I have a little issue here. I have a panel where I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.