     
     private var targetXPostion: CGFloat!
     
-    private var spinnyNode : SKShapeNode?
-    private var ground : SKSpriteNode?
+    private var spinnyNode: SKShapeNode?
+    private var ground: SKSpriteNode?
+
+    private var oneStepLength: CGFloat = 0
         
     override func didMove(to view: SKView) {
         self.ground = self.childNode(withName: "//ground") as? SKSpriteNode

    }

    private func walkAction(to x: CGFloat) {
        var walkAction = SKAction.repeat(SKAction.getWalkLeftAction(), count: 7)
        var turnOutAction = SKAction.getTurnOutLeftAction()
        if personNode.position.x < x {
            walkAction = SKAction.repeat(SKAction.getWalkRightAction(), count: 7)
            turnOutAction = SKAction.getTurnOutRightAction()
        }
        
        let movedAction = self.movedAction(to: self.targetXPostion)

        personNode.run(SKAction.group([walkAction, movedAction])) {
            let idleAction = SKAction.getIdleAction()
            self.personNode.run(SKAction.sequence([turnOutAction, idleAction]))
        }
    }

    private func movedAction(to x: CGFloat) -> SKAction {
        return SKAction.moveTo(x: x, duration: 2.1)
    }
}

        personNode.anchorPoint = CGPoint(x: 0.5, y: 0)
        personNode.position = CGPoint(x: -size.width/2 + personTexture.size().width, y: -size.height/2)
        self.addChild(personNode)

        oneStepLength = personTexture.size().width/2

        // Create shape node to use during mouse interaction
        let w = (self.size.width + self.size.height) * 0.05
