diff --git a/src/play_clj/entities.clj b/src/play_clj/entities.clj index d43b9a4..dc927f1 100644 --- a/src/play_clj/entities.clj +++ b/src/play_clj/entities.clj @@ -11,11 +11,20 @@ (defprotocol Entity (draw-entity! [this screen batch] "Draws the entity")) +(defn draw-map! + [m screen batch] + (doseq [[k v] m] + (try + (draw-entity! v screen batch) + (catch Exception _)))) + (extend-protocol Entity clojure.lang.PersistentArrayMap - (draw-entity! [this screen batch]) + (draw-entity! [this screen batch] + (draw-map! this screen batch)) clojure.lang.PersistentHashMap - (draw-entity! [this screen batch]) + (draw-entity! [this screen batch] + (draw-map! this screen batch)) nil (draw-entity! [this screen batch]))