How to make a coutdown ?

How to make a coutdown ?
0.0 0


Hello every body,
I want to make a countdown but I never managed to initialise a timer, how can i do that in C++, I see on other forum but it’s all in “objective c” so i never found the syntax to do that… i try this but it doesn’t work

In MyClass.cpp

void MyClass::TimeDisplay(CCTime dt){

In MyClass.h
void TimeDisplay(CCTime dt);

Thanks a lot in advance
Best regards


You can find solution in standart cocos2d-x example. Find it in standart tests, file IntervalTest.cpp, and modify.

Here corrections:

In MyClass.cpp
countdown = 1000;
m_label1 = CCLabelBMFont::labelWithString(“1000”, “fonts/bitmapFontTest4.fnt”);
void MyClass::TimeDisplay{
countdown —;
char str[10] = ;
m_label1~~>setString( str );

In MyClass.h
void TimeDisplay(CCTime dt);
int countdown;
CCLabelBMFont* m_label1;


Great i will try it thakns a lot !


use snprintf, IMHO


i have one variable TOTAL_TIME……i want to add that variable into dt in update method ….how can i do that….Help me