Game Development Community

Good Game Timer

by John Klotz · in Torque Game Builder · 08/07/2006 (1:01 pm) · 1 replies

I want to display a Timeleft Box in the corner with a countdown for one of my games and can't figure out how to manipulate the SetTimerOn function to do so. I got all the gui stuff down but don't think I am approaching this the correct way.

function t2dscene::onupdatescene(%this, %scenegraph)
{
   $timeleft = 10000 - SetTimerOn(10000); 

//I am assuming here that 10000 represents 10 seconds as it does elsewhere in T2D
//I am also assuming the settimeon starts at 0 and works towards how many seconds it is set too

   timeleft.setText($timeleft);
}

Not getting any errors with this. It just won't show up.

Any suggestions?

#1
08/07/2006 (4:51 pm)
What you should do is put a setTimerOn call in the startGame function in the game.cs. Then make a onTimer callback for whatever you set the timer on.

Keep in mind that you must specify which object is calling the function.

EX:
%this.setTimerOn(1000);