瀏覽代碼

Dynamically instance two players

DricomDragon 5 年之前
父節點
當前提交
3bacc7b80e
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Game.gd

+ 9 - 0
Game.gd

@@ -20,6 +20,15 @@ func _ready():
 	players.append(player) # TODO : use groups
 	add_child(player)
 
+	# Player 2
+	player = playerScene.instance()
+	player.grid = level
+	player.turn_left_action = "player_2_turn_left"
+	player.turn_right_action = "player_2_turn_right"
+	player.position = Vector2(6 * 64 + 32, 8 * 64 + 32)
+	players.append(player) # TODO : use groups
+	add_child(player)
+
 func _process(d):
 	center_camera()