feat: Add stage finish screen (mockup)

This commit is contained in:
Dendy 2026-03-05 17:34:03 +01:00
parent 17690a7e61
commit 1efde00f1e
2 changed files with 143 additions and 7 deletions

View File

@ -20,12 +20,13 @@ func _ready() -> void:
$Upgrades.update() $Upgrades.update()
$FailControl.visible = false $FailControl.visible = false
$TimeLimit.start() $FinishControl.visible = false
$HUD.visible = true $HUD.visible = true
$TimeLimit.start()
func _process(delta: float) -> void: func _process(delta: float) -> void:
# On fail screen, ignore further input # On fail screen, ignore further input
if $FailControl.visible: if $FailControl.visible or $FinishControl.visible:
return return
$HUD/StaminaRect.scale.x = stamina / max_stamina $HUD/StaminaRect.scale.x = stamina / max_stamina
@ -41,7 +42,6 @@ func _process(delta: float) -> void:
if (pedestrian_area_count > 0): if (pedestrian_area_count > 0):
speed *= SLOW_MULT speed *= SLOW_MULT
if Input.is_action_pressed("player_sprint") and stamina > 0: if Input.is_action_pressed("player_sprint") and stamina > 0:
stamina -= STAMINA_COST * delta stamina -= STAMINA_COST * delta
speed *= SPRINT_MULT speed *= SPRINT_MULT
@ -59,10 +59,9 @@ func _on_area_area_entered(area: Area3D) -> void:
print(pedestrian_area_count) print(pedestrian_area_count)
if area.name == "StationArea": if area.name == "StationArea":
stage_counter += 1 $FinishControl.visible = true
station_reached.emit() $HUD.visible = false
$TimeLimit.start() $TimeLimit.stop()
stamina = max_stamina
func _on_area_area_exited(area: Area3D) -> void: func _on_area_area_exited(area: Area3D) -> void:
@ -83,3 +82,12 @@ func _on_retry_button_pressed():
station_reached.emit() station_reached.emit()
$TimeLimit.start() $TimeLimit.start()
stamina = max_stamina stamina = max_stamina
func _on_continue_button_pressed():
stage_counter += 1
station_reached.emit()
$TimeLimit.start()
$FinishControl.visible = false
$HUD.visible = true
stamina = max_stamina

View File

@ -46,6 +46,132 @@ debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785)
wait_time = 60.0 wait_time = 60.0
one_shot = true one_shot = true
[node name="FinishControl" type="Control" parent="." unique_id=1717901238]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="BackgroundRect" type="ColorRect" parent="FinishControl" unique_id=521348599]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.39215687)
[node name="ScoreLabel" type="Label" parent="FinishControl" unique_id=847078539]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -282.0
offset_top = -87.0
offset_right = -23.0
offset_bottom = 186.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 = 200
text = "A"
horizontal_alignment = 1
vertical_alignment = 1
[node name="DescLabel" type="Label" parent="FinishControl" unique_id=566345314]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 64.0
offset_top = -109.0
offset_right = 393.0
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:"
vertical_alignment = 1
[node name="ScoreTitleLabel" type="Label" parent="FinishControl" unique_id=167720596]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -448.0
offset_top = -99.0
offset_right = 140.0
offset_bottom = -16.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 = 40
text = "Puntuació:"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TitleLabel" type="Label" parent="FinishControl" unique_id=130066362]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -294.0
offset_top = -198.0
offset_right = 294.0
offset_bottom = -115.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 = 60
text = "Has arribat a temps!"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ContinueButton" type="Button" parent="FinishControl" unique_id=873425510]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 120.0
offset_top = 87.0
offset_right = 255.5
offset_bottom = 125.0
grow_horizontal = 2
grow_vertical = 2
text = "Següent nivell"
[node name="TitleHr" type="ColorRect" parent="FinishControl" unique_id=1639067726]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -260.0
offset_top = -109.0
offset_right = 277.0
offset_bottom = -107.0
grow_horizontal = 2
grow_vertical = 2
[node name="FailControl" type="Control" parent="." unique_id=640174831] [node name="FailControl" type="Control" parent="." unique_id=640174831]
visible = false visible = false
layout_mode = 3 layout_mode = 3
@ -100,6 +226,7 @@ grow_vertical = 2
text = "Reiniciar" text = "Reiniciar"
[node name="HUD" type="Control" parent="." unique_id=1781259393] [node name="HUD" type="Control" parent="." unique_id=1781259393]
visible = false
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -158,6 +285,7 @@ shape = SubResource("CylinderShape3D_hqtel")
debug_color = Color(0.6328197, 0.113640614, 0, 0.41960785) debug_color = Color(0.6328197, 0.113640614, 0, 0.41960785)
[connection signal="timeout" from="TimeLimit" to="." method="_on_time_limit_timeout"] [connection signal="timeout" from="TimeLimit" to="." method="_on_time_limit_timeout"]
[connection signal="pressed" from="FinishControl/ContinueButton" to="." method="_on_continue_button_pressed"]
[connection signal="pressed" from="FailControl/RetryButton" to="." method="_on_retry_button_pressed"] [connection signal="pressed" from="FailControl/RetryButton" to="." method="_on_retry_button_pressed"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_area_area_entered"] [connection signal="area_entered" from="Hurtbox" to="." method="_on_area_area_entered"]
[connection signal="area_exited" from="Hurtbox" to="." method="_on_area_area_exited"] [connection signal="area_exited" from="Hurtbox" to="." method="_on_area_area_exited"]