From d92122f1b6dad7fb4fa4f4be4918620e487013a4 Mon Sep 17 00:00:00 2001 From: D L Date: Fri, 27 Jan 2023 14:35:01 -0800 Subject: [PATCH] used time_elapsed_in_race instead of time_elapsed for UI --- Scripts/GameScene.gd | 7 +++++++ 1 file changed, 7 insertions(+) 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