Kirifuri-No-Taki falls

IMG_2376.jpg

I tried (fly) fishing last weekend around Nikko region but only small sightseeing was possible because the weather was terrible..

https://www.jnto.go.jp/eng/spot/natuscen/kirifurifalls.html

Advertisements

Analog clock on SpriteKit

I just want the clock hand to spin 360 degrees but there’s something wrong…

スクリーンショット 2016-08-03 17.38.53.png

import SpriteKit

class ClockNode: SKSpriteNode, CustomNodeEvents {

  private var clockBase = SKSpriteNode(imageNamed: “base”)

  private var clockHand = SKSpriteNode(imageNamed: “hand”)

  private var clockJoint: SKPhysicsJointPin!

  func didMoveToScene() {

    guard let scene = scene else {

      return

    }

    userInteractionEnabled = true

    

    clockBase.anchorPoint = CGPoint(x: 0.5, y: 0.5)     //center

    clockBase.position = position

    addChild(clockBase)

    

    clockHand.anchorPoint = CGPoint(x: clockBase.position.x, y: clockBase.position.y)

    clockHand.position = position

    let pinPoint = CGPoint(x: clockBase.position.x,y: clockBase.position.y)

    clockJoint = SKPhysicsJointPin.jointWithBodyA(clockBase.physicsBody!, bodyB: clockHand.parent!.physicsBody!, anchor:  pinPoint)

    scene.physicsWorld.addJoint(clockJoint)    

    addChild(clockHand)

    

    clockHand.physicsBody!.applyImpulse(CGVector(dx: 50, dy: 25))

  }

}