Skip to content

Instantly share code, notes, and snippets.

@lucasprag
Created January 29, 2016 18:46
Show Gist options
  • Save lucasprag/9d67e95f1fb4b0b4a5bf to your computer and use it in GitHub Desktop.
Save lucasprag/9d67e95f1fb4b0b4a5bf to your computer and use it in GitHub Desktop.
didBeginContact
// omitted
class GameScene: SKScene, SKPhysicsContactDelegate {
// omitted
func didBeginContact(contact: SKPhysicsContact) {
if (contact.bodyA.node!.name == "player" && contact.bodyB.node!.name == "enemy") {
gameOver()
}
}
func gameOver() {
print("Game over!")
}
// omitted
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment