Guest User

Untitled

a guest
May 1st, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. class GameScene: SKScene {
  2.  
  3. var button: SKNode! = nil
  4.  
  5. override func didMoveToView(view: SKView) {
  6.  
  7. button = SKSpriteNode(color: SKColor.redColor(), size: CGSize(width: 100, height: 44))
  8.  
  9. button.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame));
  10.  
  11. self.addChild(button)
  12.  
  13.  
  14. }
  15.  
  16. override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
  17.  
  18. print("touches began touched")
  19.  
  20. for touch in touches {
  21. let location = touch.locationInNode(self)
  22.  
  23. if button.containsPoint(location) {
  24. print("button touched")
  25.  
  26. }
  27. }
Add Comment
Please, Sign In to add comment