 
 (def player (load-model "Models/Oto/Oto.mesh.xml"))
 
-(def action-key-map {:key-h (fn [n p t] (.rotate player 0 1 0))})
+(def control (.getControl player AnimControl))
 
-(def analog-key-map {:key-j (fn [n v t] (.rotate player 0 v 0))})
+(def channel (.createChannel control))
+
+(defn walk
+  [name is-pressed tpf]
+  (if (not is-pressed)
+    (doto channel
+      (.setAnim "Walk" 0.5)
+      (.setLoopMode LoopMode/Loop))))
+
+(defn cycle-done
+  [control channel name]
+  (if (.equals name "Walk")
+    (doto channel
+      (.setAnim "stand" 0.5)
+      (.setLoopMode LoopMode/DontLoop)
+      (.setSpeed 1))))
+
+(def action-key-map {:key-space walk})
 
 (defn setup-fn
   [app]

    (.setBackgroundColor viewport ColorRGBA/LightGray)
    (.setDirection light (.normalizeLocal (Vector3f. -0.1 -1 -1)))
    (.addLight root-node light)
    (.setLocalScale player (Vector3f. 0.5 0.5 0.5))))

(defn -main [& args]
  (.start (make-app :root-node player
                    :setup-fn setup-fn
                    :action-key-map action-key-map
                    :analog-key-map analog-key-map)))

  (:import com.jme3.math.ColorRGBA
           com.jme3.math.Vector3f
           com.jme3.scene.Node
           (com.jme3.animation AnimControl LoopMode)
           com.jme3.light.DirectionalLight)
  (:gen-class))

