crabs-game/scripts/menu/MainMenu.gd

17 lines
451 B
GDScript3
Raw Normal View History

2020-08-16 08:50:04 +02:00
extends Node
2020-08-20 17:32:24 +02:00
onready var music_player = get_node('/root/MusicPlayer') as MusicPlayer
2020-08-16 08:50:04 +02:00
func _ready():
$Buttons/PlayButton.grab_focus()
for button in $Buttons.get_children():
button.connect('pressed', self, '_on_Button_pressed', [button.scene_to_load])
func _on_Button_pressed(scene_to_load : String):
if scene_to_load != "":
2020-08-20 17:32:24 +02:00
music_player.fade_out()
2020-08-16 08:50:04 +02:00
get_tree().change_scene(scene_to_load)
else:
2020-08-20 17:32:24 +02:00
music_player.fade_out()
2020-08-16 08:50:04 +02:00
get_tree().quit()