 (defn off-screen [hero]
   hero)
 
-(defn stop-if-blocked [original-hero new-hero]
-  (let [new-hero-coords (blocks (new-hero :position))]
-    (if (moving? new-hero)
-      (if (> 0 (new-hero :dx))
-        ;; moving left
-        (if (= 1 (first new-hero-coords))
-          (update-in new-hero [:position :left] (fn [_] (get-in original-hero [:position :left])))
-          new-hero
-          )
-        (if (= 1 (last new-hero-coords))
-          (update-in new-hero [:position :left] (fn [_] (get-in original-hero [:position :left])))
-          new-hero
-          )
+(defn bounce [hero]
+  (update-in hero [:position :bottom] + (get-in hero [:bounce]))
+  )
+
+(defn grav [hero]
+  (let [new-hero (update-in hero [:dy] - 0.75)]
+    (update-in new-hero [:position :bottom] + (new-hero :dy))
+    )
+  )
+
+(defn vertical-block [original-hero new-hero]
+  (let [original-bottom (get-in original-hero [:position :bottom])
+        supported (on-supporting-block? (update-in (original-hero :position) [:bottom] - 1))]
+    (if supported
+      (let [nearest-vertical-border (* (ceil (/ original-bottom 70)) 70)
+            newer-hero (update-in new-hero [:position :bottom] (fn [_] nearest-vertical-border))]
+        (update-in newer-hero [:dy] (fn [_] 0))
         )
       new-hero
-      )
-    )
-  )
-
-(defn grav [hero]
-  (let [supported (most-supportive-block (hero :position))]
-    ;;(console-log supported)
-    ;;(console-log (hero :position))
-    (if (= 0 supported)
-      (let [new-hero (update-in hero [:dy] - 5)]
-        (update-in hero [:position :bottom] + (new-hero :dy))
         )
-      hero
-      )))
+      ))
+
+(defn logger [key hero]
+  ;;(console-log {key (get-in hero [:position :left])})
+  hero
+  )
 
 (defn hero [app owner]
   (reify
     om/IWillMount
     (will-mount [_]
+      (console-log "mounting...")
       (if (>= 0 (get-in @app [:hero :life]))
         (om/update! app [:game-over] true)
         (go-loop []
+          (<! (timeout 30))
 
           (let [original-hero (get-in @app [:hero])
                 new-hero (-> original-hero
+                             grav
+                             ((partial vertical-block original-hero))
                              move-horizontally
-                             ((partial stop-if-blocked original-hero))
-                             grav
-                             ;; move-vertically
-                             ;; lava-damage
-                             ;; spike-damage
-                             ;; off-screen
-                             ;; ground-resistance
-                             ;; block-resistance
-
-
-                             ;;((partial partial-check original-hero))
+                             bounce
                              )]
 
-            ;;(console-log (new-hero :jump))
-            (om/update! app [:hero] new-hero)
+            (om/transact! app [:hero] (fn [hero] (merge hero new-hero)))
             )
-
-
-          ;; (om/update! app [:hero :position :bottom] (vertical-position app))
-          ;; (when (= :left (get-in @app [:hero :move]))
-          ;;   (when (can-move :left @app)
-          ;;     (when (in-lava @app)
-          ;;       (om/transact! app [:hero :life] (fn [old] (- old 1)))
-          ;;       )
-          ;;     (om/transact! app [:hero :position :left] (fn [old] (- old 5)))))
-          ;; (when (= :right (get-in @app [:hero :move]))
-          ;;   (when (can-move :right @app)
-          ;;     (when (in-lava @app)
-          ;;       (om/transact! app [:hero :life] (fn [old] (- old 1)))
-          ;;       )
-          ;;     (om/transact! app [:hero :position :left] (fn [old] (+ old 5)))))
-
-          (<! (timeout (/ 1000 60)))
           (recur)
           )
         )

        (render [_]
          (if (>= 0 (get-in app [:hero :life]))
            (dom/h1 nil "GAME OVER")
            (dom/div #js {:className "grid" :tabIndex 0 :onKeyUp (fn [e] (stop-moving e app)) :onKeyDown (fn [e] (start-moving e app) (.preventDefault e))}
                   (om/build status-bar (:hero app))
                   (om/build hero app)
                   (om/build grid (:grid app))
                   )
            )
          )))
    app-state

  )

(def app-state (atom {:text "Hello Chestnut!"
                      :hero {:dx 0
                             :dy 0
                             :life 100
                             :position (hero-start-position grid-content)
                             :bounce 10
                             }
                      :game-over false
                      :design-game false
                      :grid grid-content}))

(defn ceil [i]
