DricomDragon 5 лет назад
Родитель
Сommit
ce3f60bfc2
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      Game.gd

+ 5 - 5
Game.gd

@@ -1,18 +1,18 @@
 extends Node2D
 
 onready var cam = $Grid/Camera1
-onready var p1 = $Grid/Player1
-onready var p2 = $Grid/Player2
+var player = []
 var dist_max = 900
 var zoom_rate = 0.001
 
 func _ready():
-	pass
+	player.append($Grid/Player1)
+	player.append($Grid/Player2)
 
 func _process(d):
-	cam.position = 0.5 * (p1.position + p2.position)
+	cam.position = 0.5 * (player[0].position + player[1].position)
 
-	var dist = (p1.position).distance_to(p2.position)
+	var dist = (player[0].position).distance_to(player[1].position)
 
 	if dist < dist_max:
 		cam.zoom = Vector2(1.0, 1.0)