1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
Felipe M b26c4a4be0
Gameover menu 2021-05-23 14:00:04 +02:00
Felipe M 175bd597c5
Music 2021-05-23 13:42:57 +02:00
11 changed files with 118 additions and 1 deletions

BIN
metroidvania/.DS_Store vendored Normal file

Binary file not shown.

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

@ -0,0 +1,22 @@
extends Node
export (Array, AudioStream) var music_list = []
var music_index = 0
onready var Player = $AudioStreamPlayer
func list_play():
assert(music_list.size() > 0)
Player.stream = music_list[music_index]
Player.play()
music_index += 1
if music_index == music_list.size():
music_index = 0
func list_stop():
Player.stop()
func _on_AudioStreamPlayer_finished():
music_list.shuffle()
list_play()

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Assets/Music and Sounds/Music.ogg" type="AudioStream" id=1]
[ext_resource path="res://Scenes/Music/Music.gd" type="Script" id=2]
[node name="Music" type="Node"]
script = ExtResource( 2 )
music_list = [ ExtResource( 1 ) ]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 1 )
[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_AudioStreamPlayer_finished"]

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

@ -7,6 +7,8 @@ onready var currentLevel = $Level_00
func _ready():
VisualServer.set_default_clear_color(Color.black)
Music.list_play()
if SaverLoader.is_loading:
SaverLoader.load_game()
SaverLoader.is_loading = false
@ -36,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"]

View File

@ -43,6 +43,7 @@ ResourceLoader="*res://ResourceLoader.gd"
Events="*res://Events.gd"
SaverLoader="*res://SaverLoader.gd"
SoundFx="*res://Scenes/Music/SoundFX.tscn"
Music="*res://Scenes/Music/Music.tscn"
[display]