explode is looking good.

This commit is contained in:
2015-04-15 01:12:51 -07:00
parent 8ee81631e0
commit a8b1b39a37
2 changed files with 192 additions and 1 deletions

View File

@@ -191,6 +191,30 @@
:fairy-godfather "No buts.")
(actions/update-state entities #(assoc % :seen-intro? true)))
(defn swing [entities]
(actions/run-action entities
(begin [this screen entities]
(update-in entities [:room :entities :ego] #(actions/start-animation screen % :swing-shovel) ))
(continue [this screen entities]
(if (and (= (get-in entities [:room :entities :ego :current-frame-index]) 3)
(not= (get-in entities [:room :entities :ego :previous-frame-index]) 3))
(do
(particle-effect! (get-in entities [:room :entities :explode]) :reset)
(particle-effect! (get-in entities [:room :entities :explode]) :start)
(update-in entities [:room :entities] dissoc :sword))
entities))
(done? [this screen entities]
(animation! (actions/find-animation (get-in entities [:room :entities :ego]) :swing-shovel)
:is-animation-finished
(- (:total-time screen) (get-in entities [:room :entities :ego :anim-start]))))
(terminate [this screen entities]
(actions/stop screen entities :ego))
(can-skip? [this screen entities]
false)))
(defn make [screen]
@@ -221,6 +245,7 @@
(assoc (texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
(assoc (texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)]
:entities {:magic (assoc (particle-effect "dream/magic") :x 160 :y 80 :baseline 240)
:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241)
:sword (assoc (texture "dream/sword.png")
:x 144 :y 122 :baseline 139
@@ -228,7 +253,8 @@
(read-sword-plaque entities))
:scripts {:shovel (actions/get-script entities
(actions/walk-to entities :ego [148 76] :face :right)
(actions/play-animation entities :ego :swing-shovel))})
(swing entities))})
:explode (assoc (particle-effect "dream/explode") :x 150 :y 138 :baseline 240)
:broom (assoc (texture "dream/broom.png") :x 286 :y 122
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)