 
 (extend-type Paddle
   IControllable
-  (control! [{:keys [y vy] :as paddle} event]
-    (case event
-      :up (assoc paddle :y (- y vy))
-      :down (assoc paddle :y (+ y vy))
+  (control! [{:keys [y vy height] :as paddle} event]
+    (condp = event
+      :up
+      (if (> (- y vy) 0) (assoc paddle :y (- y vy)) paddle)
+
+      :down
+      (if (< (+ y vy height) SCALE-H ) (assoc paddle :y (+ y vy)) paddle)
+
+      :else
       paddle)))
 
 ;;-----------------------------------------------------------------------------

  (swap! state #(assoc % :ball (move (:ball %)))))

(defn animate!
  []
  (move-phase!)
  (draw-phase! ctx)
  (.requestAnimationFrame js/window animate!))

;;-----------------------------------------------------------------------------
;; Control
;;-----------------------------------------------------------------------------

(defn resize!
  [e]
  (let [w (- (.-innerWidth js/window) 40)
        h (- (int (/ (* w 9) 16)) 40)]
    (-> (by-id "canvas")

(defn listen!
  [el type fn]
  (.addEventListener el type fn false))

;;-----------------------------------------------------------------------------

