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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:38:27+00:00 2026-06-05T14:38:27+00:00

So, i have a basic game scenerario: Some unit moves close to an enemy

  • 0

So, i have a basic game scenerario:

Some unit moves close to an enemy unit, shoots projectile and then enemy unit’s life is adjusted. My problem is that I am not sure how to schedule these three events to run one after another. If all these actions were done on the same target, then this would be super easy, but there are two different targets.

What would be best approach to do this?

Code looks like this:

Unit* unit = [self getActiveUnit];
Unit* enemy = [self getEnemyInRange:unit];

CGpoint A = unit.sprite.position;
CGPoint B = [self getPositionClose:enemy for:unit];

CCSequence* unitMove = [self generateUnitMoveFrom:A to:B];

Projectile* proj = [self generateProjectile];
CCSequence* projMove = [self generateProjMoveFrom:A to:B];

CCSequence* attackDone = [self generateAttackDoneFor:unit enemy:enemy];

// This is the part that i don't know how to do
// Execute these in order and sequentially, not at the same time
[unit.sprite runAction:unitMove];
[proj.sprite runAction:projMove];
[proj.sprite runAction:removeSprite];
[self runAction:attackDone];

What is the best approach to do this? Even using CCActionManager it still seems fairly complicated because i think i would have to add an extra call back between all these actions to resume scheduled actions for the next target.

Any ideas?

Thanks!

  • 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-05T14:38:29+00:00Added an answer on June 5, 2026 at 2:38 pm

    I would attempt to use CCSequence

    [self runAction:[CCSequence actions:
      [CCCallFuncO actionWithTarget:unit.sprite selector:@selector(runAction:) object:unitMove],
      [CCCallFuncO actionWithTarget:proj.sprite selector:@selector(runAction:) object:projMove],
      [CCCallFuncO actionWithTarget:proj.sprite selector:@selector(runAction:) object:removeSprite],
      [CCCallFunc actionWithTarget:self selector:@selector(attackDone)],
                         nil]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have some basic game loop in a thread, like this: public void
I have been developing a game basic card game for Android. At the moment
I am making a basic platform game for the iPhone and I have encountered
I am making a basic little game in Java and I want to have
My current class is planning on creating a basic networked game, but we have
I have a pretty basic challenge-based iPhone game, and I wanted to know what
Consider I have a game-creation framework, with a basic class called Game. // Action
I have coded a basic game in JavaScript and am working on a high
I'm developing a small game in Java and I have run into a problem
I'm working on a very basic game and I have a std::list collection of

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.