Godsim/scripts/ingame_menu_button.gd

25 lines
566 B
GDScript3
Raw Normal View History

extends Button
@onready var button = $"."
@onready var main_menu = $".."
var world_scene = preload("res://scenes/world.tscn")
func _ready():
print("ready")
enable()
func enable():
$".".pressed.connect(self._button_pressed)
func disable():
$".".pressed.disconnect()
func _button_pressed():
if ("save_world" in name):
World.save_world()
elif ("save_exit" in name):
World.save_world()
get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
elif ("exit_nosave" in name):
get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")