【发布时间】:2017-06-04 15:47:24
【问题描述】:
我想单击某个 spritenode 并更改该 spritenode 的值。这是问题所在。当我这样做并设置一个 if 语句时,它知道要转到该 if 语句。但是,我不希望它在下次单击按钮之前运行。
例子:
apple.name = "apple"
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
let node : SKNode = self.atPoint(location)
if node.name == "apple" {
appple.name = "orange"
print("Hello")
}
if node.name = "orange" {
//do this
}
}
}
有没有办法做到这一点?
【问题讨论】:
标签: swift sprite-kit sknode