           (assoc explosion :entities [part1 part2 part3 (assoc part4 :frame-ticks (- frame-ticks 1))])
 
     )))
+
+
+

            [clojure.pprint :refer [pprint]]))

(def ^:const x-offset (c/screen-to-world -3))

(def ^:const y-offset (c/screen-to-world 2))

(def ^:const default-frame-ticks 1)

;(def explosion-sound (sound "explosion.ogg"))

(defn create-circle-texture [c]
  (let [pix-map (pixmap* 16 16 (pixmap-format :r-g-b-a8888))]

      (pixmap! :fill-circle 8 8 7.5))
    (texture pix-map)))

(defn create-circle-entity [width radius c]
  (let [circle-entity (create-circle-texture c)]
    (assoc circle-entity
      :width (c/screen-to-world (* 2 width)) :height (c/screen-to-world (* 2 width))
      :ttl 12 :frame-ticks default-frame-ticks
      )))

(defn create-explosion [x y]
  (let [textures (cond (empty? @explosion-textures)
                       (reset! explosion-textures
                               [(create-circle-entity 8 7.5 (color :black))
                                (create-circle-entity 7 6.5 (color :orange))
                                (create-circle-entity 6 5.5 (color :yellow))
                                (create-circle-entity 1 1.5 (color :white))])
                       :else @explosion-textures)
        explosion (bundle
                    (assoc (textures 0) :x (- x layer1-width) :y (- y layer1-width))
                    (assoc (textures 1) :x (- x layer2-width) :y (- y layer2-width))
                    (assoc (textures 2) :x (- x layer3-width) :y (- y layer3-width))
                    (assoc (textures 3) :x (- x layer4-width) :y (- y layer4-width))
                    )]
    (sound "explosion.ogg" :play)
    (assoc explosion :explosion? true :render-layer 100)))

