crabs-game/scripts/menu/MainMenu.gd

13 lines
326 B
GDScript3
Raw Permalink Normal View History

2020-08-16 08:50:04 +02:00
extends Node
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 != "":
get_tree().change_scene(scene_to_load)
else:
get_tree().quit()