Game time

Blitz3D Forums/Blitz3D Programming/Game time

Oiduts Studios(Posted 2009) [#1]
So i am trying to get a working clock for my game but i have a problem, the time for the sky works on 360, so i am wondering if someone can help me convert this into hours and mins, if i have not given enough information then please ask. Great thanks.


Gabriel(Posted 2009) [#2]
So you have a value between 0 and 360 and you want to convert that into a value from 0 to 24, is that correct?

Then the answer is going to be

FloatHours#=Degrees/15.0
Hours%=Floor(FloatHours)

You may or may not want to subtract 12 from Hours at this point, depending on whether your sun is up or down at 0 degrees. We need FloatHours because we need the remainder in a moment to calculate the minutes.

So then for minutes you have

Minutes%=60*(FloatHours-Hours)

Is that what you were after?


Oiduts Studios(Posted 2009) [#3]
wow, it works perfectly thanks, that saves me a lot of time.