             (e/create-ogres 20)]
            flatten
            (reduce #(e/randomize-locations screen %1 %2) []))))
+  
   :on-render
   (fn [screen entities]
     (clear!)
     (let [me (u/get-player entities)]
+      ; update health bars
+      (->> (some #(if (= (:id %) (:mouse-npc-id screen)) %) entities)
+           (run! npc-health-screen :on-update-health-bar :entity))
+      (run! overlay-screen :on-update-health-bar :entity me)
+      ; run game logic
       (->> entities
            (map (fn [entity]
                   (->> entity

            [play-clj.core :refer :all]
            [play-clj.g2d :refer :all]
            [play-clj.ui :refer :all]))

(defonce manager (asset-manager))
(set-asset-manager! manager)

     ; this is meant for testing particle effects
     (comment assoc (particle-effect "particles/fire.p")
            :id :particle)])
  
  :on-render
  (fn [screen entities]
    (->> (for [entity entities]
           (case (:id entity)
             :fps (doto entity (label! :set-text (str (game :fps))))
             entity))
         (render! screen)))
  
  :on-resize
  (fn [screen entities]
    (height! screen 300)
    (for [e entities]
      (case (:id e)
        :particle (assoc e :x (width screen) :y 0)
        e)))
  
  ; custom function that is invoked in main-screen
  :on-update-health-bar
  (fn [screen entities]
    (for [entity entities]
      (case (:id entity)
        :bar (let [me (:entity screen)
                   pct (/ (:health me) (+ (:health me) (:wounds me)))]
               (shape entity
                      :set-color (color :red)
                      :rect 0 0 u/bar-w u/bar-h
                      :set-color (color :green)
                      :rect 0 0 u/bar-w (* u/bar-h pct)))
        entity))))

(defgame dungeon-crawler
  :on-create
