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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:37:16+00:00 2026-06-16T00:37:16+00:00

I used to stopAllActions when running a new action. I noticed some problems when

  • 0

I used to stopAllActions when running a new action. I noticed some problems when using the CCTintBy action as the colour was progressively being added and the call to “reverse” (see in CCTintBy the (CCActionInterval*) reverse function) was not being called (as stopped).

This made me wonder on my current approach and understanding of CCActions.

For instance. I used to call [self stopAllActions] whenever running a new action but this doesn’t quiet fit with the usage of CCTintBy action (it does stop also that action and leave the sprite being half coloured and the base colour would have changed as the reverse function would not have being called as being stopped by the stopAllActions).

I leave you with the most common actions in my project. I was thinking to instead of calling stopAllActions, to call only stop a specific action if the action is not already running. Would this be good practice?

 -(void) runExplosionAnimation
 {
[self stopAllActions];
//here should verify if the action is not already running and if so stop it
//To do so I should have a member variable like: CCAction * explosionAnim = [CCSequence actions: [CCAnimate actionWithDuration:0.4f animation:anim restoreOriginalFrame:false],  [CCHide action],  nil];
//Plus a boolean to distinguish if it is already running.. 

CCAnimation* anim = [[CCAnimationCache sharedAnimationCache] animationByName:@"bbb"];
if(anim!=nil){
    [self runAction:[CCSequence actions: [CCAnimate actionWithDuration:0.4f animation:anim restoreOriginalFrame:false],  [CCHide action],  nil]];
}
else{
    [self loadSharedAnimationIfNeeded];
}
}

A way around to using a boolean to determien if the CCTintBy action is still running is to restore the original colour manually before calling the CCTintBy action again.

-(void) gotHitWithFactor:(int)factor
    {
[self runGotHitAnimation];

self.hitPoints -= factor * 1;
if (self.hitPoints <= 0)
{
    isAlive=false;  
    [self runExplosionAnimation]; //Will also set enemy visibility to false
}
 }

-(void) runGotHitAnimation
{
    //hitAction is initialized as [CCTintBy actionWithDuration:0.1f red:100 green:100 blue:111];

    [self stopAction:hitAction];
    self.color = originalColour; //Where originalcolour is initialized as self.colour
    [self runAction:hitAction];
}
  • 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-16T00:37:17+00:00Added an answer on June 16, 2026 at 12:37 am

    You know you can tag actions, right?

    The CCNode class has methods to:

    stopActionByTag:
    getActionByTag:
    

    If you run a new action, you just need to tell which other actions need to stop in each particular case. For complex action usage I recommend to split your actions logically into two groups: gameplay and visual.

    Gameplay actions are all actions influencing gameplay, such as movement. Visual are just that, visual effects, like skewing, rotation, tinting. The point in this distinction is that it makes it easier to prioritize actions. Mainly, visual actions should never stop, run or otherwise influence gameplay actions.

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

Sidebar

Related Questions

Used rails to generate new project. Added twitter-bootstrap-rails to Gemfile source 'https://rubygems.org' gem 'rails',
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
Used this tutorial I have installed jogl, jocl, gluegen, joal libs and added its
Used one hidden element to capture changed value and change the element value using
Used the following to fix the problems (for the remaining issues, will change my
I used the ASP.NET (.NET4) default ASPNETDB.mdf database that gets created when using membership,
Being used to the standard way of sorting strings, I was surprised when I
I used CSharpCodeProvider to compile and generate a new namespace in the memory for
I used standard hough transforms to obtain the straight lines in an image using
Used as a scripting language, does Scala have some sort of include directive, or

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.