 (defn ^:export move [{:keys [x y velocity-x velocity-y] :as sprite}]
   "Moves a sprite based on its velocity on the x and y-axis"
   (assoc sprite
-    :x (if velocity-x (+ x velocity-x) x)
-    :y (if velocity-x (+ y velocity-y) y)))
+         :x (+ x velocity-x)
+         :y (+ y velocity-y)))
 
 (defn- update-sprite
   [& [sprite scene :as args]]

  (update [this] (update-sprite this))
  (update [this scene] (update-sprite this scene)))

(defrecord AnimatedSprite [animation width height x y]
  TypeInfo
  (get-type [this] :animated-sprite)
  SpriteActions

  (update [this] (update-sprite this))
  (update [this scene] (update-sprite this scene)))

(defn image-sprite
  "Creates a sprite represented by the given image with the specified values"
  ([{:keys [image] :as data}]
   (let [{:keys [width height]} image]
     (merge (ImageSprite. image width height 0 0 0 0)
            data)))
  ([{:keys [width height] :as image} x y]
   (image-sprite image width image x y 0 0))
  ([image width height x y]
   (image-sprite image width height x y 0 0))
  ([image width height x y velocity-x velocity-y]
   (ImageSprite. image width height x y velocity-x velocity-y)))

(defrecord SpritesheetSprite [spritesheet cell width height x y velocity-x velocity-y]
  TypeInfo
  (get-type [this] :spritesheet-sprite)
  SpriteActions
