|
@@ -33,6 +33,7 @@ func start():
|
|
|
for p in players:
|
|
|
p.queue_free()
|
|
|
if (levelCurrentNode):
|
|
|
+ remove_child(levelCurrentNode)
|
|
|
levelCurrentNode.queue_free()
|
|
|
|
|
|
# Select level
|
|
@@ -48,6 +49,9 @@ func start():
|
|
|
levelCurrentNode = levelScenes[levelIndex].instance()
|
|
|
add_child(levelCurrentNode)
|
|
|
|
|
|
+ # Retrieve player spawn points
|
|
|
+ var spawners = get_tree().get_nodes_in_group("spawn")
|
|
|
+
|
|
|
# Create players
|
|
|
var player
|
|
|
|
|
@@ -56,7 +60,7 @@ func start():
|
|
|
player.grid = levelCurrentNode
|
|
|
player.turn_left_action = "p1_left"
|
|
|
player.turn_right_action = "p1_right"
|
|
|
- player.position = Vector2(4 * 64 + 32, 8 * 64 + 32)
|
|
|
+ player.position = spawners[0].position
|
|
|
add_child(player)
|
|
|
|
|
|
# Player 2
|
|
@@ -64,7 +68,7 @@ func start():
|
|
|
player.grid = levelCurrentNode
|
|
|
player.turn_left_action = "p2_left"
|
|
|
player.turn_right_action = "p2_right"
|
|
|
- player.position = Vector2(6 * 64 + 32, 8 * 64 + 32)
|
|
|
+ player.position = spawners[1].position
|
|
|
add_child(player)
|
|
|
|
|
|
# Player 3
|
|
@@ -72,7 +76,7 @@ func start():
|
|
|
player.grid = levelCurrentNode
|
|
|
player.turn_left_action = "p3_left"
|
|
|
player.turn_right_action = "p3_right"
|
|
|
- player.position = Vector2(8 * 64 + 32, 8 * 64 + 32)
|
|
|
+ player.position = spawners[2].position
|
|
|
add_child(player)
|
|
|
|
|
|
# TODO Timer
|