1

I have Class that is CCNode extended from one of its methods i want to excute actions but none of then are running : from this class :

class GameController : public CCNode

where i have also this:

void GameController::onEnter()
{
    CCNode::onEnter();
}

this is the code i have :

bool GameController::removeFinalGems(CCArray* gemsToRemove)
{

    onGemScaleInAnim = CCCallFuncND::create(this,
                                                 callfuncND_selector(GameController::OnGemScaleInAnim),gemsToRemove); 

     onRemoveGemScaleInAnim = CCCallFuncND::create(this,
                                                 callfuncND_selector(GameController::OnRemoveGemScaleInAnim),gemsToRemove); 

    CCSequence* selectedGemScaleInAndRemove = CCSequence::create(onGemScaleInAnim,
                                                                onRemoveGemScaleInAnim, 
                                                                    NULL);

    bool b = this->isRunning();
    CCAction *action = this->runAction(selectedGemScaleInAndRemove);


    return true;
}

void GameController::OnGemScaleInAnim(CCNode* sender,void* data)
{


    CCArray *gemsToRemove = (CCArray*) data; 



}

void GameController::OnRemoveGemScaleInAnim(CCNode* sender,void* data)
{


    CCArray *gemsToRemove = (CCArray*) data; 

}

also i added check to see if there is actions running before and after and its look like before its equal 0 and after it is equal 1

int na = this->numberOfRunningActions();  //equal 0 
CCAction *action = this->runAction(selectedGemScaleInAndRemove);
int na0 = this->numberOfRunningActions();//equal 1 so there is action

it never gets to the OnRemoveGemScaleInAnim and OnGemScaleInAnim methods

user63898
  • 29,839
  • 85
  • 272
  • 514

1 Answers1

0

I ran into this problem on cocos2d-x when porting an iOS cocos2d app. After your "runAction" call, add the following line of code to check to see if paused target(s) is the culprit:

    CCDirector::sharedDirector()->getActionManager()->resumeTarget( this );

In my case, this was the reason why actions were not being run. It seems that CCTransitionFade's (from screen transitions) resulted in pauses. It might be due to construction of nodes done during init, although I have not tested that theory.

GtotheB
  • 2,727
  • 4
  • 21
  • 17