1 decade ago by BennyT
Hi all,
Had a look through the forums and couldn't specifically find anything on this.
Imagine a racing game where the level is the track and I want to time how long it takes to complete. Since the time to complete is unknown, using the Impact Timers is out.
I am looking for a best practice solution that isn't going to bog down the game.
My first thought is to use some native JavaScript and a bit of date/time maths.
So when the level loads I was going to initiate:
var startTime = Date.now();
and then have a trigger at the end of the track that runs the same line:
var finishTime = Date.now();
and then do the maths to get the minutes and seconds.
If anyone has a better why to do it, please let me know
Thanks!
Had a look through the forums and couldn't specifically find anything on this.
Imagine a racing game where the level is the track and I want to time how long it takes to complete. Since the time to complete is unknown, using the Impact Timers is out.
I am looking for a best practice solution that isn't going to bog down the game.
My first thought is to use some native JavaScript and a bit of date/time maths.
So when the level loads I was going to initiate:
var startTime = Date.now();
and then have a trigger at the end of the track that runs the same line:
var finishTime = Date.now();
and then do the maths to get the minutes and seconds.
If anyone has a better why to do it, please let me know
Thanks!