particled step.

This commit is contained in:
2015-02-18 17:39:36 -08:00
parent 4789df90f9
commit 914c18dfc6
3 changed files with 42 additions and 32 deletions

View File

@@ -224,6 +224,8 @@
entities)
(continue [this screen entities]
(when (= (rand-int 50) 2)
(particle-effect! (:step-particles entities) :start))
(let [{from-x :x from-y :y :keys [left right scale-x] :as target-entity} (get-in entities [:room :entities target-id])
[[target-x target-y] remainder] @targets-left]
(let [delta-x (- target-x from-x)
@@ -240,7 +242,9 @@
(do (swap! targets-left rest)
(-> entities
(assoc-in [:room :entities target-id :x] target-x)
(assoc-in [:room :entities target-id :y] target-y)))
(assoc-in [:room :entities target-id :y] target-y)
(assoc-in [:step-particles :x] target-x)
(assoc-in [:step-particles :y] target-y)))
(update-in entities [:room :entities target-id]
#(start-animation screen
(assoc (jump-to screen entities % [(+ moved-x from-x) (+ moved-y from-y)] true)