我有一个自定义类,它是一个SKNode,而其中又包含几个SKSpriteNodes。有什么方法可以从我的游戏场景中检测到这些子SKSpriteNode上的触摸?
我工作很快
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