lots of ending improvements

This commit is contained in:
Bryce Covert
2018-02-10 18:32:29 -08:00
parent c37309fac1
commit 2ab191c2d5
47 changed files with 1112 additions and 356 deletions

View File

@@ -9,13 +9,14 @@
(println "loading " *ns*)
(defn make-entity [id {:keys [scripts script only-script] :as entity}]
(merge entity
{:id id
:mouse-in? (fn [entities x y]
(let [e (utils/get-entity entities id)]
(if-let [[bx1 by1 bx2 by2] (:box e)]
(zone/within bx1 by1 bx2 by2 x y)
(let [{^float entity-x :x ^float entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (-> entities :room :entities id)
(let [{^float entity-x :x ^float entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (-> entities :room :entities (get id))
width (or width (if (instance? TextureRegion region ) (.getRegionWidth ^TextureRegion region) 0))
height (or height (if (instance? TextureRegion region ) (.getRegionHeight ^TextureRegion region) 0))