Browse Source

Instantiate level programatically

DricomDragon 5 years ago
parent
commit
f19c8ffb67
3 changed files with 66 additions and 61 deletions
  1. 7 3
      Game.gd
  2. 1 58
      Game.tscn
  3. 58 0
      Levels/Lab.tscn

+ 7 - 3
Game.gd

@@ -1,15 +1,19 @@
 extends Node2D
 
 onready var cam = $MainCamera
-onready var level = $Grid
-var dist_max = 900
-var zoom_rate = 0.001
+export var dist_max = 900
+export var zoom_rate = 0.001
 
+var level
 var playerScene = preload("res://Player.tscn")
 
 func _ready():
 	var player
 
+	# Load level
+	level = preload("res://Levels/Lab.tscn").instance()
+	add_child(level)
+
 	# Player 1
 	player = playerScene.instance()
 	player.grid = level

File diff suppressed because it is too large
+ 1 - 58
Game.tscn


File diff suppressed because it is too large
+ 58 - 0
Levels/Lab.tscn