Sunday, June 02, 2013

Running Code After X Seconds Delay in Cocos2D-x

Assuming you have a class called YOUR_CLASS in Cocos2-dx

You use something like this:

CCCallFunc* moveCallback = CCCallFunc::create(this, callfunc_selector(YOUR_CLASS::callfunc_selector_startTurn));

CCDelayTime* delayAction = CCDelayTime::create(2.0f);

this->runAction(CCSequence::create(delayAction, moveCallback, NULL));


And include a function like this for the CCCallFunc to call


void YOUR_CLASS::callfunc_selector_startTurn(void)
{
// do some stuff
}

Inspired by this blog post:





1 Comments:

At Wednesday, November 25, 2020 1:04:00 AM, Anonymous erectile dysfunction remedies said...

Hi there, I found your web site by way of Google at the same time as searching for a comparable subject, your website came up, it appears great. I have bookmarked it in my google bookmarks.
Hi there, simply become aware of your blog through Google, and located that it's truly informative. I'm going to watch out for brussels. I'll be grateful if you continue this in future. Lots of people will probably be benefited from your writing. Cheers!

 

Post a Comment

<< Home