0
生成網格我有這個陣列塊的:從陣列
3210我添加16塊到該陣列。這裏是我如何生成一個4x4網格:
for i in 0...3 {
for j in 0...3 {
for b in blocks {
b.position = CGPoint(x: CGFloat(i)*b.frame.size.width + xOffset, y: yPos)
addChild(b) <<-- Error here
yPos = yPos - b.frame.size.height - yOffset
}
}
我得到這個錯誤:
Attemped to add a SKNode which already has a parent
我應該怎麼做嗎?
的工作,感謝更換線
16倍,它應該工作。 – Abdou023