From 4f601ec9f70f03cdb3a89ec5382b53a0d6b2393d Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Thu, 5 Mar 2026 18:41:24 +0100 Subject: [PATCH] feat: Change rank based on time left --- player.gd | 18 +++++++++++++++++- player.tscn | 1 - 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/player.gd b/player.gd index b19bdbf..f418206 100644 --- a/player.gd +++ b/player.gd @@ -9,6 +9,13 @@ const SLOW_MULT = 0.5 const STAMINA_COST = 15 const STAMINA_RECOVER = 10 +const SCORE_RANK = { + "C": { "time": 10, "money": 500, "color": Color.BROWN }, + "B": { "time": 20, "money": 1000, "color": Color.PURPLE }, + "A": { "time": 30, "money": 1500, "color": Color.GREEN }, + "S": { "time": 999, "money": 2000, "color": Color.YELLOW }, +} + var pedestrian_area_count = 0 var max_stamina: float = BASE_STAMINA @@ -61,9 +68,18 @@ func _on_area_area_entered(area: Area3D) -> void: if area.name == "StationArea": $FinishControl.visible = true $HUD.visible = false + var scoreLbl = $FinishControl/ScoreLabel + for letter in SCORE_RANK: + var rank = SCORE_RANK[letter] + if $TimeLimit.time_left > rank["time"]: + continue + + scoreLbl.text = letter + scoreLbl.add_theme_color_override("font_color", rank["color"]) + break + $TimeLimit.stop() - func _on_area_area_exited(area: Area3D) -> void: if area.name == "PedestrianArea": pedestrian_area_count -= 1 diff --git a/player.tscn b/player.tscn index 565952a..7cdf284 100644 --- a/player.tscn +++ b/player.tscn @@ -97,7 +97,6 @@ offset_bottom = 4.0 grow_horizontal = 2 grow_vertical = 2 pivot_offset_ratio = Vector2(0.5, 0.5) -theme_override_colors/font_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 20 text = "Diners guanyat: Diners total:"