Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20160928 時計仕掛けのアヒル

Kei Ito
September 28, 2016

20160928 時計仕掛けのアヒル

関モバ #18 の資料です

Kei Ito

September 28, 2016
Tweet

More Decks by Kei Ito

Other Decks in Programming

Transcript

  1. Ξώϧ let duck = SKSpriteNode(texture: tex, size: size) duck.physicsBody =

    SKPhysicsBody(texture: tex, alphaThreshold: 0.2, size: size) bath.addChild(duck)
  2. ܏͖ var sign = 1 if WKInterfaceDevice.current().crownOrientation == .left {

    sign = -1 } physicsWorld.gravity = CGVector(dx: x * sign, dy: y * sign)
  3. ͸͘͡ @IBAction func handlePan(_ sender: AnyObject) { let pan =

    sender as! WKPanGestureRecognizer let velocity = pan.velocityInObject() duck.physicsBody?.velocity = CGVector(dx: velocity.x * r, dy: -velocity.y * r) }