Game Development Community

Need Help with Timer

by Rutgers Preparatory School (#000 · in Technical Issues · 08/13/2007 (3:10 pm) · 1 replies

Hello,

I've remade the 'fish game' tutorial into a space-themed survival game. However, I'm having trouble with making a working timer that displays how long the player has been alive, and stopping once the player dies. If any of you could help me, it would be greatly appreciated.

Thanks.

About the author

Recent Threads


#1
08/17/2007 (7:14 am)
I would go with the "getRealTime ()" script command.
Call it once to save your start time:
$startTime = getRealTime ();

Then call it again to get the difference
$timeSpent = getRealTime () - $startTime;

getRealTime() returns the current time in milleseconds