Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

How To Make a Game Like Space Invaders with Sprite Kit and Swift Tutorial: Part 2

Learn how to make a game like Space Invaders in Swift, in this 2-part Sprite Kit tutorial!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2207-how-to-make-a-game-like-space-invaders-with-sprite-kit-and-swift-tutorial-part-2

this was a great tutorial, I also used the monkey pinch tutorial it was also great
I am just getting started with Xcode 7.2 and swift – I did have problem with the touch detection, it did not compile, the code I found that worked is below

// User Tap Helpers

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
    
    super.touchesBegan(touches, withEvent: event)
}

override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
    
    if let touch = touches.first {
        
        if (touch.tapCount == 1) {
            
            self.tapQueue.append(1)
        }
    }

    super.touchesEnded(touches, withEvent: event)
}

override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
    
    super.touchesMoved(touches, withEvent: event)
}