Tracking Time
I know I saw a post about this a few weeks ago, but I can't find it anymore. I'm looking to track how much time has progressed in levels. Right now I'm just tracking time in seconds, but how can I convert that into hrs minutes and seconds? I know I'll need 3 attributes, one for hours, one for minutes, one for seconds, but what's the math required?
I think for Hours I need the number of times 3600 goes in whole, for minutes how many times 60 goes in, and the remainder is seconds, but I'm lost on how to do that. anyone tackle this already?
I think for Hours I need the number of times 3600 goes in whole, for minutes how many times 60 goes in, and the remainder is seconds, but I'm lost on how to do that. anyone tackle this already?
Comments
hours = seconds % 3600
Or minutes:
minutes = seconds % 60
And the remaining seconds:
seconds = seconds - (hours * 3600) - (minutes * 60)
http://gamesalad.com/forums/topic.php?id=1885#post-10322
this is because 60 goes evenly into 360 with nothing left over. I need this to return 6 instead of 0. This works fine for seconds, as it would be an even minute. But for minutes, it doesn't cut it.
secondly, since I'm using this for time, is there a way to get gamesalad to force double digits for values under 10?... 03 instead of just 3.
Mulcahy - fancy making a game called 'T is for Time Travel?'
QS
Greg