|
@@ -10,6 +10,8 @@ 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"]
|
|
|
|
|
|
func _ready():
|
|
|
for k in range(levelNames.size()):
|
|
@@ -55,29 +57,13 @@ func start():
|
|
|
# Create players
|
|
|
var player
|
|
|
|
|
|
- # Player 1
|
|
|
- player = playerScene.instance()
|
|
|
- player.grid = levelCurrentNode
|
|
|
- player.turn_left_action = "p1_left"
|
|
|
- player.turn_right_action = "p1_right"
|
|
|
- player.position = spawners[0].position
|
|
|
- add_child(player)
|
|
|
-
|
|
|
- # Player 2
|
|
|
- player = playerScene.instance()
|
|
|
- player.grid = levelCurrentNode
|
|
|
- player.turn_left_action = "p2_left"
|
|
|
- player.turn_right_action = "p2_right"
|
|
|
- player.position = spawners[1].position
|
|
|
- add_child(player)
|
|
|
-
|
|
|
- # Player 3
|
|
|
- player = playerScene.instance()
|
|
|
- player.grid = levelCurrentNode
|
|
|
- player.turn_left_action = "p3_left"
|
|
|
- player.turn_right_action = "p3_right"
|
|
|
- player.position = spawners[2].position
|
|
|
- add_child(player)
|
|
|
+ for k in 3:
|
|
|
+ player = playerScene.instance()
|
|
|
+ player.grid = levelCurrentNode
|
|
|
+ player.turn_left_action = playerActionsLeft[k]
|
|
|
+ player.turn_right_action = playerActionsRight[k]
|
|
|
+ player.position = spawners[k].position
|
|
|
+ add_child(player)
|
|
|
|
|
|
# TODO Timer
|
|
|
get_tree().call_group("players", "_on_game_start")
|