used time_elapsed_in_race instead of time_elapsed for UI

This commit is contained in:
D L 2023-01-27 14:35:01 -08:00
parent 35a288d34f
commit d92122f1b6
1 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,11 @@ const I_T_JUST_RELEASED : int = 2
var stage_env
var time_elapsed : float = 0
var stage_finished : bool = false
# for UI
var time_elapsed_in_race : float = 0
var player_speed_mph : float = 0
var rng = RandomNumberGenerator.new()
@ -79,6 +84,8 @@ func _process(delta):
stage_env.interact(unit, delta)
unit.react(delta)
time_elapsed += delta
if !stage_finished:
time_elapsed_in_race += delta
# 1 grid unit = 2ft, 1 grid unit / s = 1.36 mph
player_speed_mph = sqrt(pow(player.v_speed, 2) + pow(player.h_speed, 2)) * 1.36