فهرست منبع

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()