diff --git a/Scripts/GameScene.gd b/Scripts/GameScene.gd index ef96c26..4173779 100644 --- a/Scripts/GameScene.gd +++ b/Scripts/GameScene.gd @@ -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