scene里有3个方法要重载
//touch 开始
override func touchesBegan(_ touches: Set, with event: UIEvent?)
//touch 结束
override func touchesEnded(_ touches: Set, with event: UIEvent?)
//touch 移动
override func touchesMoved(_ touches: Set, with event: UIEvent?)
//for 循环应该是控制多点的 未测试确认
for touch in touches{
//得到touch的一个location
let location = touch.location(in: self)
//得到当前location所在的node
if let xxx = atPoint(location) as? xxNode
最后让node的position = location,实现移动
}
补充:
通过在按下抬起 设置zposition,可以让按住的node一直在最上面显示