1
0
Fork 0

Gameover menu

This commit is contained in:
Felipe M 2021-05-23 14:00:04 +02:00
parent 175bd597c5
commit b26c4a4be0
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
7 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,13 @@
extends CenterContainer
func _on_QuitButton_pressed():
SoundFx.play_fx("Click", 1, -30)
get_tree().quit()
func _on_LoadButton_pressed():
Music.list_stop()
SaverLoader.is_loading = true
SoundFx.play_fx("Click", 1, -30)
get_tree().change_scene("res://Scenes/World/World.tscn")

View File

@ -0,0 +1,56 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/UI/DefaultTheme.tres" type="Theme" id=1]
[ext_resource path="res://Scenes/Menus/GameOverMenu.gd" type="Script" id=2]
[node name="GameOverMenu" type="CenterContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 102.0
margin_top = 70.0
margin_right = 218.0
margin_bottom = 109.0
[node name="Label" type="Label" parent="VBoxContainer"]
margin_right = 116.0
margin_bottom = 15.0
theme = ExtResource( 1 )
text = "GAME OVER"
align = 1
valign = 1
[node name="Control" type="Control" parent="VBoxContainer"]
margin_top = 19.0
margin_right = 116.0
margin_bottom = 19.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 23.0
margin_right = 116.0
margin_bottom = 39.0
rect_min_size = Vector2( 56, 16 )
[node name="LoadButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_right = 56.0
margin_bottom = 16.0
rect_min_size = Vector2( 56, 16 )
theme = ExtResource( 1 )
text = "LAST SAVE"
[node name="QuitButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 60.0
margin_right = 116.0
margin_bottom = 16.0
rect_min_size = Vector2( 56, 16 )
theme = ExtResource( 1 )
text = "QUIT"
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LoadButton" to="." method="_on_MainMenuButton_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LoadButton" to="." method="_on_LoadButton_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]

View File

@ -19,5 +19,6 @@ func _on_QuitButton_pressed():
get_tree().quit()
func _process(_delta):
if Input.is_action_just_pressed("pause"):
var PlayerIsAlive = get_tree().get_nodes_in_group("Player").size() > 0
if Input.is_action_just_pressed("pause") and PlayerIsAlive:
self.paused = !paused

View File

@ -43,6 +43,7 @@ onready var powerupDetector = $PowerupDetector
onready var cameraFollow = $CameraFollow
signal hit_door(door)
signal died
func set_invincible(value):
@ -271,6 +272,7 @@ func _on_Hurtbox_hit(damage):
SaverLoader.custom_data.health = PlayerStats.health
func _on_died():
emit_signal("died")
queue_free()
func _on_PowerupDetector_area_entered(area):

View File

@ -124,6 +124,7 @@ tracks/1/keys = {
[node name="Player" type="KinematicBody2D" groups=[
"Persists",
"Player",
]]
collision_mask = 2
script = ExtResource( 2 )

View File

@ -38,3 +38,7 @@ func get_door_with_connection(outgoingDoor):
return door
return null
func _on_Player_died():
yield(get_tree().create_timer(1.0), "timeout")
get_tree().change_scene("res://Scenes/Menus/GameOverMenu.tscn")

View File

@ -23,5 +23,7 @@ remote_path = NodePath("../../Camera")
[node name="Level_00" parent="." instance=ExtResource( 1 )]
position = Vector2( -132, -32 )
[connection signal="died" from="Player" to="." method="_on_Player_died"]
[editable path="Player"]
[editable path="Player/Hurtbox"]