count in milliseconds

count in milliseconds
0.0 0


I am trying to spawn 3 sprites at three intervals in one second but I dont know how to count in milliseconds or tens of seconds so that I can have the sprite spawned at say 1.3 seconds.
Does anyone know how I can do this?
All help is greatly appreciated!


I use Frame Rate Not timer as my game run 60FPS thats 60fps per 1 second theres lots of ways to do it.

  1. add a Variable. int counter = 0;
  2. In your game loop increment your counter. counter++;
  3. use an if statement when if (counter 130 ) thats 1.3 seconds cos where counting fps

I prefer to do this in a class and call the update function in the main loop;

class Timer

int count;

count = 0;

// Call this in your game loop
void UpdateTimer(void)

  if (count \> 0) {

 if (count  0 ) {

//Do Somting

//Sleep for 1.3 secounds
count = 130;


Hope this helps


Thanks that worked perfectly.
I did work out how to get the time in milliseconds if anyone needs it.

float getMilliCount(){

    timeb tb;

    float nCount;
    nCount = tb.millitm + (tb.time & 0xfffff) * 1000;
    return nCount;