Skip to content

Instantly share code, notes, and snippets.

@lucasprag
Last active January 29, 2016 12:22
Show Gist options
  • Save lucasprag/caeaf4079a3725cc8307 to your computer and use it in GitHub Desktop.
Save lucasprag/caeaf4079a3725cc8307 to your computer and use it in GitHub Desktop.
Touch me to impulse
// omitted
class GameScene: SKScene {
// omitted
override func didMoveToView(view: SKView) {
// omitted
}
// This method is called when the user touches the screen
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
// we apply an impulse to the axis Y of 70
player.physicsBody?.applyImpulse(CGVector(dx: 0.0, dy: 70.0))
}
// omitted
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment