Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GameScene: SKScene {
- var button: SKNode! = nil
- override func didMoveToView(view: SKView) {
- button = SKSpriteNode(color: SKColor.redColor(), size: CGSize(width: 100, height: 44))
- button.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame));
- self.addChild(button)
- }
- override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
- print("touches began touched")
- for touch in touches {
- let location = touch.locationInNode(self)
- if button.containsPoint(location) {
- print("button touched")
- }
- }
Add Comment
Please, Sign In to add comment