As the game progresses we increase the spawn rate of the enemies
As the game progresses we increase the spawn rate of the enemies
This function calculates how far along the game is, as a value between 0.0 (just started) and 1.0 (complete).
timer.time_left gives the number of seconds remaining on the timer.
Dividing that by game_length gives the proportion of the game remaining.
Subtracting from 1.0 inverts that, giving the proportion of the game completed.
For example:
If time_left is 15 and game_length is 30, this returns 1.0 - 0.5 = 0.5, meaning 50% complete.