From 1efde00f1e5b6043b2b3620cbe53086889f4f9d2 Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Thu, 5 Mar 2026 17:34:03 +0100 Subject: [PATCH] feat: Add stage finish screen (mockup) --- player.gd | 22 ++++++--- player.tscn | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 7 deletions(-) diff --git a/player.gd b/player.gd index 934859a..b19bdbf 100644 --- a/player.gd +++ b/player.gd @@ -20,12 +20,13 @@ func _ready() -> void: $Upgrades.update() $FailControl.visible = false - $TimeLimit.start() + $FinishControl.visible = false $HUD.visible = true + $TimeLimit.start() func _process(delta: float) -> void: # On fail screen, ignore further input - if $FailControl.visible: + if $FailControl.visible or $FinishControl.visible: return $HUD/StaminaRect.scale.x = stamina / max_stamina @@ -40,7 +41,6 @@ func _process(delta: float) -> void: if (pedestrian_area_count > 0): speed *= SLOW_MULT - if Input.is_action_pressed("player_sprint") and stamina > 0: stamina -= STAMINA_COST * delta @@ -59,10 +59,9 @@ func _on_area_area_entered(area: Area3D) -> void: print(pedestrian_area_count) if area.name == "StationArea": - stage_counter += 1 - station_reached.emit() - $TimeLimit.start() - stamina = max_stamina + $FinishControl.visible = true + $HUD.visible = false + $TimeLimit.stop() func _on_area_area_exited(area: Area3D) -> void: @@ -83,3 +82,12 @@ func _on_retry_button_pressed(): station_reached.emit() $TimeLimit.start() 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 diff --git a/player.tscn b/player.tscn index e484181..565952a 100644 --- a/player.tscn +++ b/player.tscn @@ -46,6 +46,132 @@ debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785) wait_time = 60.0 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] visible = false layout_mode = 3 @@ -100,6 +226,7 @@ grow_vertical = 2 text = "Reiniciar" [node name="HUD" type="Control" parent="." unique_id=1781259393] +visible = false layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -158,6 +285,7 @@ shape = SubResource("CylinderShape3D_hqtel") debug_color = Color(0.6328197, 0.113640614, 0, 0.41960785) [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="area_entered" from="Hurtbox" to="." method="_on_area_area_entered"] [connection signal="area_exited" from="Hurtbox" to="." method="_on_area_area_exited"]