|
@@ -3,15 +3,15 @@ extends Node2D
|
|
|
onready var cam = $MainCamera
|
|
|
onready var timer = $StartTimer
|
|
|
|
|
|
-var levelNames = ["res://Levels/Focus.tscn", "res://Levels/Lab.tscn", "res://Levels/Square.tscn"]
|
|
|
-var levelScenes = []
|
|
|
-var levelCurrentNode
|
|
|
-var levelIndex = -1
|
|
|
-
|
|
|
# Used to test a level in creation
|
|
|
export (String) var levelToLoop
|
|
|
var levelSceneToLoop
|
|
|
|
|
|
+export (Array, String) var levelNames = ["Square"]
|
|
|
+var levelScenes = []
|
|
|
+var levelCurrentNode
|
|
|
+var levelIndex = -1
|
|
|
+
|
|
|
var playerScene = preload("res://Player.tscn")
|
|
|
var playerActionsLeft = ["p1_left", "p2_left", "p3_left"]
|
|
|
var playerActionsRight = ["p1_right", "p2_right", "p3_right"]
|
|
@@ -21,10 +21,14 @@ func _ready():
|
|
|
levelScenes.append(null)
|
|
|
|
|
|
if levelToLoop:
|
|
|
- levelSceneToLoop = load("res://Levels/" + levelToLoop + ".tscn")
|
|
|
+ levelSceneToLoop = load_level(levelToLoop)
|
|
|
if !levelSceneToLoop:
|
|
|
push_error("Cant't load level " + levelToLoop)
|
|
|
|
|
|
+func load_level(name):
|
|
|
+ var fullName = "res://Levels/" + name + ".tscn"
|
|
|
+ return load(fullName)
|
|
|
+
|
|
|
func _unhandled_input(event):
|
|
|
if event.is_action("ui_accept") and event.is_pressed():
|
|
|
if get_tree().has_group("living"):
|
|
@@ -53,7 +57,7 @@ func create_game():
|
|
|
levelIndex = 0
|
|
|
|
|
|
if !levelScenes[levelIndex]:
|
|
|
- levelScenes[levelIndex] = load(levelNames[levelIndex])
|
|
|
+ levelScenes[levelIndex] = load_level(levelNames[levelIndex])
|
|
|
|
|
|
levelCurrentNode = levelScenes[levelIndex].instance()
|
|
|
|