You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
535 B

  1. extends Node
  2. export var scenes : Dictionary
  3. signal end
  4. func _ready():
  5. load_scene("TestLVL")
  6. func load_scene(scene_key):
  7. yield(get_tree(),"idle_frame")
  8. print(scene_key)
  9. if scenes.has(scene_key):
  10. for child in $SceneContainer.get_children():
  11. child.queue_free()
  12. var scene = scenes[scene_key].instance()
  13. scene.connect("request_new_scene", self, "load_scene")
  14. $SceneContainer.add_child(scene)
  15. func wait_signal(args):
  16. yield(self, "end")
  17. func _input(event):
  18. if event.is_action_pressed("ui_cancel"):
  19. emit_signal("end")