extends Node

export var scenes : Dictionary

signal end

func _ready():
	load_scene("TestLVL")

func load_scene(scene_key):
	yield(get_tree(),"idle_frame")
	print(scene_key)
	if scenes.has(scene_key):
		for child in $SceneContainer.get_children():
			child.queue_free()
		var scene = scenes[scene_key].instance()
		scene.connect("request_new_scene", self, "load_scene")
		$SceneContainer.add_child(scene)

func wait_signal(args):
	yield(self, "end")

func _input(event):
	if event.is_action_pressed("ui_cancel"):
		emit_signal("end")
