Tracking Time
jonmulcahy
Member, Sous Chef Posts: 10,408
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)
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
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.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Mulcahy - fancy making a game called 'T is for Time Travel?'
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Greg