Skip to content

Commit

Permalink
Add optional args
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamada committed Sep 28, 2014
1 parent adcca99 commit 38432c3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/phaser_cljs/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@


;;; This is heavy
(defn add-particle-emitter! [k]
(doto (-> @game .-add (.emitter 0 0 50))
(.makeParticles (name k))))

(defn emit-particle! [pe x y]
(set! (.-x pe) x)
(set! (.-y pe) y)
(.start pe true 500 nil 10))
(defn add-particle-emitter! [k & [max-number]]
(let [max-number (or max-number 50)]
(doto (-> @game .-add (.emitter 0 0 max-number))
(.makeParticles (name k)))))

(defn emit-particle! [pe x y & [lifespan quantity]]
(let [lifespan (or lifespan 500)
quantity (or quantity 10)]
(set! (.-x pe) x)
(set! (.-y pe) y)
(.start pe true lifespan nil quantity)))



Expand Down

0 comments on commit 38432c3

Please sign in to comment.