From a8b1b39a37ee8127d0af245b7e15c3b35ad0574f Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Wed, 15 Apr 2015 01:12:51 -0700 Subject: [PATCH] explode is looking good. --- desktop/resources/dream/explode | 165 ++++++++++++++++++ .../src-common/advent/screens/rooms/dream.clj | 28 ++- 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 desktop/resources/dream/explode diff --git a/desktop/resources/dream/explode b/desktop/resources/dream/explode new file mode 100644 index 00000000..f3b6d5cf --- /dev/null +++ b/desktop/resources/dream/explode @@ -0,0 +1,165 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 700.0 +lowMax: 700.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 250.0 +highMax: 250.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.15753424 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 2000.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.66 +timeline2: 1.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 5.0 +highMax: 5.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 10.0 +highMax: 10.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 2.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 100.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.5714286 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5205479 +timeline2: 1.0 +- Angle - +active: true +lowMin: 90.0 +lowMax: 90.0 +highMin: 0.0 +highMax: 360.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.97959185 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 1280.0 +highMax: -1280.0 +relative: true +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: -40.0 +highMax: -40.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 0.0 +scaling2: 0.8979592 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.34931508 +timeline2: 1.0 +- Tint - +colorsCount: 3 +colors0: 0.7372549 +colors1: 0.95686275 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.31578946 +scaling1: 0.75438595 +scaling2: 0.75 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.19178082 +timeline2: 0.8 +timeline3: 1.0 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +dot.png diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 84f85526..205f0f29 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -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)