How to make a basic chronometer

How to make a basic chronometer
0.0 0


I’m looking for a basic way to put a chronometer in the hud of my game but didn’t understand how I must use CCTimer class to accomplish that.

I just would like to show the seconds since the begining of the level and lauch the gameover sequence when 60sec past.
If anybody already makes that and have some code, would be great.


How to schedule an update function is explained in Chapter 5 of the wiki.
The update function provides delta time (dt).
You could keep track of the game running time by adding delta time to a variable each frame.

gametime += dt;