Skip to content

Instantly share code, notes, and snippets.

@efrenjgb
Created April 19, 2015 07:22
Show Gist options
  • Save efrenjgb/7c97b482acc76462cdb8 to your computer and use it in GitHub Desktop.
Save efrenjgb/7c97b482acc76462cdb8 to your computer and use it in GitHub Desktop.
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
/* Called when a touch begins */
for touch in (touches as! Set<UITouch>) {
let location = touch.locationInNode(self)
moveShipTo(location)
self.fireWeapon = true
}
}
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch in (touches as! Set<UITouch>) {
let location = touch.locationInNode(self)
moveShipTo(location)
}
}
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch in (touches as! Set<UITouch>) {
let location = touch.locationInNode(self)
self.fireWeapon = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment