            (and (= z-side :bottom) (= normal (vector-2 0.0 -1.0)))
            (and (= z-side :left) (= normal (vector-2 -1.0 0.0)))))))
 
+(defmulti apply-event (fn [_ _ [type & _]] type))
+
+(defmethod apply-event :player-moved [screen entities [_ direction]]
+  (on-key-move-cell entities direction))
+
+(defn apply-events [{:keys [events] :as screen} entities]
+  (reduce (fn [entities evt]
+            (apply-event screen entities evt))
+          entities
+          events))
+
 (defscreen main-screen
 
            :on-show


                 (game-over screen)

                 (->> entities
                      (step! screen)
                      change-player-level
                      (animate-player screen)
                      (animate-plante screen)
                      (animate-enemies screen)
                      (map set-enemy-in-zone)
                      (map move-enemy)
                      (render! screen)))))

           :on-key-down
           (fn [{:keys [key]} entities]
             (when-let [direction (key->direction key)]
               (on-key-move-cell entities direction)))

           :on-resize
           (fn [screen _]

                (create-player-entity screen)]))

           :on-render
           (fn [screen entities]


             (clear!)

