Detect touch on child node of object in SpriteKit

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
    }
}

Source: http://www.raywenderlich.com/84434/sprite-kit-swift-tutorial-beginners

Leave a Comment