Skip to content

Instantly share code, notes, and snippets.

@junaidk
Created August 1, 2013 14:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junaidk/6131963 to your computer and use it in GitHub Desktop.
Save junaidk/6131963 to your computer and use it in GitHub Desktop.
Cocos2dx action sequence -- call a function after an action completion
int *value = new int(3);
CCLog("*value = %d", *value); //=> I get 3 here => ok
_coinsLabel->runAction((CCSequence*)CCSequence::actions(
CCDelayTime::actionWithDuration(.05f),
CCCallFuncND::actionWithTarget(this, callfuncND_selector(GameLayer::addCoins),(void*) value),
NULL));
//function to called
void GameLayer::addCoins((CCNode* sender, void* data)
{
int *value = (int*) data;
CCLog("*value = %d", *value);
// some code...
delete value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment