feat: Add Gameover screen with retry button
This commit is contained in:
parent
240c05bc66
commit
990f797597
10
player.gd
10
player.gd
|
|
@ -16,7 +16,10 @@ var stamina: float = max_stamina
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$Upgrades.update()
|
$Upgrades.update()
|
||||||
|
|
||||||
|
$FailControl.visible = false
|
||||||
$TimeLimit.start()
|
$TimeLimit.start()
|
||||||
|
$HUD.visible = true
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
$HUD/StaminaLabel.text = str(int(stamina))
|
$HUD/StaminaLabel.text = str(int(stamina))
|
||||||
|
|
@ -59,5 +62,12 @@ func _on_area_area_exited(area: Area3D) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_time_limit_timeout():
|
func _on_time_limit_timeout():
|
||||||
|
$FailControl.visible = true
|
||||||
|
$HUD.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_retry_button_pressed():
|
||||||
|
$FailControl.visible = false
|
||||||
|
$HUD.visible = true
|
||||||
station_reached.emit()
|
station_reached.emit()
|
||||||
$TimeLimit.start()
|
$TimeLimit.start()
|
||||||
|
|
|
||||||
54
player.tscn
54
player.tscn
|
|
@ -46,7 +46,60 @@ debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785)
|
||||||
wait_time = 10.0
|
wait_time = 10.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="FailControl" type="Control" parent="." unique_id=640174831]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="FailControl" unique_id=1806162242]
|
||||||
|
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="TitleLabel" type="Label" parent="FailControl" unique_id=1727971844]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -220.0
|
||||||
|
offset_top = -63.0
|
||||||
|
offset_right = 220.0
|
||||||
|
offset_bottom = 20.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 = "Temps esgotat!"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="RetryButton" type="Button" parent="FailControl" unique_id=1422422701]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -38.0
|
||||||
|
offset_top = 36.5
|
||||||
|
offset_right = 38.0
|
||||||
|
offset_bottom = 67.5
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
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
|
||||||
|
|
@ -91,5 +144,6 @@ 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="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"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue