feat: Change rank based on time left

This commit is contained in:
Dendy 2026-03-05 18:41:24 +01:00
parent 1efde00f1e
commit 4f601ec9f7
2 changed files with 17 additions and 2 deletions

View File

@ -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,8 +68,17 @@ func _on_area_area_entered(area: Area3D) -> void:
if area.name == "StationArea":
$FinishControl.visible = true
$HUD.visible = false
$TimeLimit.stop()
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":

View File

@ -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:"