Skip to content

Commit

Permalink
Add load_scene to globals
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero committed Mar 26, 2016
1 parent 7fe8d6a commit 06e91d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ var level = null

var paused = false

func load_scene(scene_name):
return ResourceLoader.load("res://scenes/" + scene_name + ".scn")

func _ready():
var main_scene = get_tree().get_root().get_node("main")

camera = ResourceLoader.load("res://scenes/camera.scn").instance()
camera = load_scene("camera").instance()
main_scene.add_child(camera)

fade = ResourceLoader.load("res://scenes/fade.scn").instance()
fade = load_scene("fade").instance()
main_scene.add_child(fade)

set_scene("test_level0")
Expand Down

0 comments on commit 06e91d9

Please sign in to comment.