fix hightscore animation position and add new highscore text

This commit is contained in:
interfisch 2025-04-13 14:15:51 +02:00
parent a545b8134f
commit 3bbbbf7567
2 changed files with 20 additions and 21 deletions

View file

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

View file

@ -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)