(Sorry for the poor formatting)
func _process(delta):
your_time_variable += delta
func format_my_time():
var time_elapsed = float(your_time_variable)
var s = int(time_elapsed) % 60
var min = int(time_elapsed) / 60
var m = min % 60
var h = min / 60
if m < 10:
m = str("0" + str(m))
if s < 10:
s = str("0" + str(s))
time.text = str(h) + ":" + str(m) + ":" + str(s).pad_decimals(0)
You could theoretically go up to days and years, just using 24 and 365. That is not necessary for my game, but the pattern remains the same. If you need something really precise, accounting for leap years or leap seconds, then I might recommend using something in the Time singleton
0 comments