我喜欢创造左侧和右侧,当我触摸它们时,一只鸟会向左或向右飞!
为什么它不起作用。我的方法错了吗?我还有别的办法让它起作用吗??请帮帮忙,非常感谢
发布于 2015-07-29 12:06:58
在您的touchesBegan方法中,请尝试如下:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
if let touch = touches.first as? UITouch {
let touchLocation = touch.locationInNode(self)
if nodeAtPoint(touchLocation) == groundleft { //your sprite node
//do something
}
}
super.touchesBegan(touches , withEvent:event)
}https://stackoverflow.com/questions/31699918
复制相似问题