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 8670837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:48:06+00:00 2026-06-12T18:48:06+00:00

I want to run an action and go on go on processing game logic

  • 0

I want to run an action and go on go on processing game logic at the same time, but action is interrupted when the process is going on. I tried to use thread, but I couldn’t make it work. When it’s not needed to process game logic the sprites move as I expected, but when it’s needed to make some operations during action, the action is interrupted during the operation time. After the operation is ended, the action is going on.
What am I doing wrong?

I call a selector as follows – the selector starts the action.

[NSThread detachNewThreadSelector:@selector(moveSprite:)
                         toTarget:self
                       withObject:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   sprite, @"sprite",
                                                   [NSValue valueWithCGPoint:pos], @"pos",
                                                   nil]];


-(void) moveSprite: (NSDictionary*) parameters {
    CCSprite *sprite = [parameters objectForKey:@"sprite"];
    CGPoint pos = [[parameters objectForKey:@"pos"] CGPointValue];
    id actionMove = [CCMoveTo actionWithDuration:0.4f position:pos];
    id actionMoveDone = [CCCallFuncND actionWithTarget:self selector:@selector(removeSprite:data:) data:(__bridge void*)sprite];
    [sprite runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];
}

After the action ends I remove the sprite by following method.

-(void) removeSprite: (id)sender data:(void*)data {
    CCSprite *sprite = (__bridge CCSprite*)data;
    [self removeChild:sprite cleanup:YES];
}
  • 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-06-12T18:48:08+00:00Added an answer on June 12, 2026 at 6:48 pm

    First, it makes no sense to create actions in a separate thread. The actions are added to the node, and the node along with its actions are updated on the main thread.

    You should also know that threading will only help you if the device has two or more CPU cores. On a single core device (iPhone 4 or earlier, iPod Touch 4 or earlier, iPad 1) running a separate thread that performs heavy duty operations will still slow down if not halt the main thread.

    If your game logic is that heavy that it actually halts the screen updates, you need to optimize whatever you’re doing. You could spread the calculation across multiple frames, profile to see if you can optimize, or if you’re using a brute force approach research more clever, less straightforward but faster algorithms.

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

Sidebar

Related Questions

I want to know why I can't run the button action in secondary thread(see
In Rails, I want to run the js.erb file associated with an action on
We want to time how long certain actions run for in an ASP.NET MVC
I want to run some code from an ASP.NET MVC controller action in a
For instance, say I want to run some logic and then hit /page.html#elementid <h:commandLink
I want to be able to input java commands/code to execute during run-time (during
We have a custom action that we want to run ONLY on a major
In the selection of how often I want to run my action the only
if ($sess_uid == $WallID) { // } else { Run Action } Works But
Problem is: I want to run 3 different actions but instead of that 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.