                         ~symb)))))
     `(do ~@body)))
 
-(defmacro with-sprite-set [canvas layer bindings & body]
+(defmacro with-sprite-set* [canvas layer bindings & body]
   (assert-args
    (vector? bindings) "a vector for its binding"
    (even? (count bindings)) "an even number of forms in binding vector")

          layer (second bindings)
          val (nth bindings 2)]
      `(let [~symb ~val
             canvas# (infinitelives.pixi.canvas/get)]
         (try (.addChild
               (get-layer canvas# ~layer)
               ~symb)

              (finally (.removeChild (get-layer ~canvas ~layer) ~symb)))))
    `(do ~@body)))

(defmacro with-sprite [& body]
  (cond
    (vector? (first body))
    `(with-sprite*
       (infinitelives.pixi.canvas/get-default-canvas) (infinitelives.pixi.canvas/get-default-layer)
       ~(first body)
       ~@(next body))

    (vector? (second body))
    `(with-sprite*
       (infinitelives.pixi.canvas/get-default-canvas) ~(first body)
       ~(second body)
       ~@(nnext body))

    :default
    `(with-sprite* ~@body)))

(comment
  (macroexpand-1 '(with-sprite [a (ms)] a b c)))

(defmacro with-layered-sprite [bindings & body]
  (assert-args
   (vector? bindings) "a vector for its binding"
