Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func didMoveToView(view: SKView) {
- /// GRID ///
- grid.anchorPoint = CGPointMake(0.5, 0.5)
- grid.position = CGPointMake(self.size.width / 2, self.size.height / 2)
- grid.size.width = self.size.width * 0.8
- grid.size.height = grid.size.width
- grid.zPosition = 10
- self.addChild(grid)
- /// BALL ///
- ball.anchorPoint = CGPointMake(0.5, 0.5)
- ball.size.width = grid.size.width / 5
- ball.size.height = ball.size.width
- ball.position = CGPointMake(0, 0) // THE BALL IS AT THE CENTER OF THE GRID
- grid.addChild(ball)
- // SWIPE DOWN DETECTION
- let swipeDown:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: Selector("swipeDown:"))
- swipeDown.direction = .Down
- view.addGestureRecognizer(swipeDown)
- }
- func swipeDown(send:UISwipeGestureRecognizerDirection) {
- let moveAction = SKAction.moveBy(CGVectorMake(0, -grid.size.height / 5), duration: 0.1)
- ball.runAction(moveAction)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement