更新时间:2023-02-01 20:00:26
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) {
let touch = touches.anyObject() as UITouch
let touchLocation = touch.locationInNode(self)
if([yourSprite containsPoint: touchLocation])
{
//sprite contains touch
}
}
来源:http://www.raywenderlich.com/84434/sprite-kit-swift-tutorial-beginners