【发布时间】:2015-07-14 21:54:16
【问题描述】:
我正在尝试在一个节点上执行多个操作。
例如,在第一次触摸该节点时,第一个动作应该运行。在第二次触摸时:第二个动作应该运行。
下面是带有 touches.count 的代码无效示例。
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
let node = self.nodeAtPoint(location)
if node == myNode {
if touches.count == 1 {
action1()
}
if touches.count == 2 {
action2()
}
if touches.count == 3 {
action3()
}
}
}
}
【问题讨论】:
标签: ios swift sprite-kit