In a racing game I want to display a timer on top of the screen.
In a variable called time I store the elapsed time since the start of the game:
time =+ delta
I want to represente the time as MM:SS.dd, where MM are the elapsed minutes, SS are the seconds and dd are the tenths of seconds.
Since I need to show the zeros on the left when the numbers are between 0 and 9, after calculating the single portions of the time, I use the following to format the string:
LabelNode.text = ("0" + str(minutes)).right(2) + ":" + ("0" + str(seconds)).right(2) + ":" + ("0" + str(tenths)).right(2)
Unfortunately, it does not work.
It works instead whit the simple (but non suitable) form:
LabelNode.text = str(minutes) + ":" + str(seconds) + ":" + str(tenths)
Can anyone find the mistake I was not able to detect?