瀏覽代碼

Put the camera between the two players

One single camera for two players.
DricomDragon 5 年之前
父節點
當前提交
0bf0f53b16
共有 2 個文件被更改,包括 20 次插入4 次删除
  1. 13 0
      Game.gd
  2. 7 4
      Game.tscn

+ 13 - 0
Game.gd

@@ -0,0 +1,13 @@
+extends Node2D
+
+var cam
+var p1
+var p2
+
+func _ready():
+	cam = $Grid/Camera1
+	p1 = $Grid/Player1
+	p2 = $Grid/Player2
+
+func _process(d):
+	cam.position = 0.5 * (p1.position + p2.position)

文件差異過大導致無法顯示
+ 7 - 4
Game.tscn