質問編集履歴

2

//override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?){を変更した。

2018/08/07 10:21

投稿

fugu
fugu

スコア35

test CHANGED
File without changes
test CHANGED
@@ -68,7 +68,9 @@
68
68
 
69
69
 
70
70
 
71
+
72
+
71
- override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?){
73
+ override func touchesMoved(_ touches: Set<UITouch>, with: UIEvent?){
72
74
 
73
75
  let location = touches.first!.location(in: self)
74
76
 

1

座標のズレを確認しました。

2018/08/07 10:21

投稿

fugu
fugu

スコア35

test CHANGED
File without changes
test CHANGED
@@ -74,6 +74,12 @@
74
74
 
75
75
  self.position = location
76
76
 
77
+ //この行を追加して座標を確認しました。
78
+
79
+ print("Square",self.position,"location",location)
80
+
81
+
82
+
77
83
  }
78
84
 
79
85
 
@@ -87,3 +93,33 @@
87
93
  }
88
94
 
89
95
  ```
96
+
97
+ 座標のログの最初の数行です
98
+
99
+ 四角ノードのポジションをx:100, y:100に設定しているので
100
+
101
+ ズレているようです。
102
+
103
+ ```log
104
+
105
+ Square (-2.33332824707031, 6.3333740234375) location (-2.33332824707031, 6.3333740234375)
106
+
107
+ Square (100.333320617676, 100.666618347168) location (100.333320617676, 100.666618347168)
108
+
109
+ Square (-1.66666412353516, 7.66672515869141) location (-1.66666412353516, 7.66672515869141)
110
+
111
+ Square (100.999992370605, 101.333267211914) location (100.999992370605, 101.333267211914)
112
+
113
+ Square (-0.333320617675781, 10.0001068115234) location (-0.333320617675781, 10.0001068115234)
114
+
115
+ Square (101.666641235352, 102.33325958252) location (101.666641235352, 102.33325958252)
116
+
117
+ Square (1.66670227050781, 13.3334121704102) location (1.66670227050781, 13.3334121704102)
118
+
119
+ Square (102.666625976562, 103.999969482422) location (102.666625976562, 103.999969482422)
120
+
121
+ Square (2.00003814697266, 14.0000152587891) location (2.00003814697266, 14.0000152587891)
122
+
123
+ Square (103.666618347168, 105.666679382324) location (103.666618347168, 105.666679382324)
124
+
125
+ ```