Game Clock: Time Remaining
by Mychal McCabe · in Torque Game Engine · 02/09/2002 (10:04 am) · 3 replies
I was wondering if anyone had implemented a clock that counts time remaining in a game, and if so if they had any pointers or code they'd be willing to share.
one of our programmers pointed me in the following direction:
***
$Game::StartTime is set to some number of milliseconds when the game starts, and then you can later check $Sim::Time and compare it to $Game::StartTime to see how much time has elapsed, and from that calculate what to display. (Of course, you'd need to know how to display big numbers in a nice font.)
So, the other part of that would be arranging for that code to be called regularly; as I mentioned before, I don't think there's any entry point to the scripting that is regularly polled, but there's probably some way to arrange for future callbacks, so that the code could show the clock, set a callback to run itself again in one second, repeat.
***
This is a little less opaque than Greek to me, so I'll monkey around with this today, and post results as I come up with them.
Thanks.
mychal mccabe
badlands games
mychal@badlandsgames.com
one of our programmers pointed me in the following direction:
***
$Game::StartTime is set to some number of milliseconds when the game starts, and then you can later check $Sim::Time and compare it to $Game::StartTime to see how much time has elapsed, and from that calculate what to display. (Of course, you'd need to know how to display big numbers in a nice font.)
So, the other part of that would be arranging for that code to be called regularly; as I mentioned before, I don't think there's any entry point to the scripting that is regularly polled, but there's probably some way to arrange for future callbacks, so that the code could show the clock, set a callback to run itself again in one second, repeat.
***
This is a little less opaque than Greek to me, so I'll monkey around with this today, and post results as I come up with them.
Thanks.
mychal mccabe
badlands games
mychal@badlandsgames.com
About the author
Associate Justin Mette
Default Studio Name
Justin Mette
21-6 Productions