extends Node const floor_file_path = "res://scenes/floors/Floor" # 加载指定楼层 func load_by_floor(f:int) -> void: var root = get_tree().get_root().get_node("Main") var next_floor = load("%s%s%s" % [floor_file_path,f,".tscn"]).instance() as Node2D var used_items = GameArchiveManager.get_used_item(f) root.get_node("Floor%s" % f).free() root.add_child(next_floor) for used_item in used_items: var node = next_floor.get_node(used_item) if node != null: node.free()