extends Node2D var destination_map = { "oustide":preload("res://scenes/outside.tscn"), } func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed("menu"): open_menu() # list of scenes var current_scene = "menu" var outside = null var menu = null func start_game(): menu = get_child(0) if outside == null: outside = destination_map["oustide"].instantiate() add_child(outside) remove_child(menu) current_scene = "outside" func open_menu(): remove_child(outside) add_child(menu) current_scene = "menu"