extends Node export (PackedScene) var about = load("res://scenes/UI/About.tscn") export (PackedScene) var scenes = load("res://scenes/UI/ChooseScene.tscn") var current_scene = null # Quit the game func _on_Quit_pressed(): get_tree().quit(0) # Load scene about func _on_About_pressed(): _prepare_change_scene() current_scene = about.instance() add_child(current_scene) # Load scene for select game func _on_New_pressed(): _prepare_change_scene() current_scene = scenes.instance() add_child(current_scene) ## PRIVATE func _prepare_change_scene(): if (current_scene != null): remove_child(current_scene) current_scene.call_deferred("free")