From 3bbbbf7567a87b808073fdf87b57d285760cd1e8 Mon Sep 17 00:00:00 2001 From: Fisch Date: Sun, 13 Apr 2025 14:15:51 +0200 Subject: [PATCH] fix hightscore animation position and add new highscore text --- scenes/game.tscn | 35 +++++++++++++++++------------------ scripts/game.gd | 6 +++--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/scenes/game.tscn b/scenes/game.tscn index d6c8cfe..1bc1e8c 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -200,7 +200,7 @@ tracks/0/keys = { "times": PackedFloat32Array(0, 0.7, 2), "transitions": PackedFloat32Array(1, 1, 1), "update": 0, -"values": [Vector2(92.1386, 36.868), Vector2(92.1386, 36.868), Vector2(410, 72)] +"values": [Vector2(92.1386, 36.868), Vector2(120, 36.868), Vector2(480, 72)] } tracks/1/type = "value" tracks/1/imported = false @@ -422,23 +422,6 @@ text = "3" horizontal_alignment = 1 vertical_alignment = 1 -[node name="highscore_label" type="Label" parent="hud"] -visible = false -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -57.5 -offset_top = 2.70999 -offset_right = 57.5 -offset_bottom = 71.71 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_font_sizes/font_size = 50 -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="splittime_label" type="Label" parent="hud"] modulate = Color(1, 1, 1, 0) anchors_preset = 8 @@ -466,6 +449,22 @@ offset_right = 1190.0 offset_bottom = 682.0 color = Color(0.482353, 0.482353, 0.482353, 0.52549) +[node name="highscore_label" type="Label" parent="hud"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -57.5 +offset_top = 2.70999 +offset_right = 57.5 +offset_bottom = 71.71 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_font_sizes/font_size = 50 +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="times_container" type="HFlowContainer" parent="hud"] anchors_preset = 8 anchor_left = 0.5 diff --git a/scripts/game.gd b/scripts/game.gd index 0de57ba..abc7b73 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -265,7 +265,7 @@ func _on_car_finished(playerid,finalTime) -> void: finishGame()# Game finished func _on_car_on_checkpoint(playerid,checkpointtimes,i) -> void: - if Gamestate.getPlayers().size()==1 and highscorecheckpointtimes != null: #singleplayer and previous split times exista + if Gamestate.getPlayers().size()==1 and highscorecheckpointtimes != null: #singleplayer and previous split times exists # calculate split times var timediff = checkpointtimes[i]-highscorecheckpointtimes[i] @@ -315,8 +315,8 @@ func finishGame(): highscore_label.text=="+"+str(timediff) highscore_label.modulate=Color(200,200,0) elif timediff<0: #new highscore - highscore_label.text=str(timediff) - highscore_label.modulate=Color(0,0,200) + highscore_label.text="New Highscore\n"+str(timediff) + highscore_label.modulate=Color(0,200,0) elif timediff>0: #worse time highscore_label.text="+"+str(timediff) highscore_label.modulate=Color(200,0,0)