smoke animation.

This commit is contained in:
2015-02-12 21:04:09 -08:00
parent 30a5ffd91a
commit d576e377ed
2 changed files with 33 additions and 8 deletions

View File

@@ -37,19 +37,44 @@
e))
(defn swing-at-blergh [entities]
(let [jump-path (bezier (map #(apply vector-2* %) [[15 45] [110 145] [195 180]]))
(let [jump-path (bezier (map #(apply vector-2* %) [[35 45] [110 145] [195 180]]))
swing-path (bezier (map #(apply vector-2* %) [[195 180] [205 45]]))
jump-dist (utils/dist 15 45 205 45)
jump-dist (utils/dist 35 45 205 45)
speed 190.0
jump-duration (/ jump-dist speed)
swing-dist (utils/dist 195 180 205 45)
swing-duration (/ swing-dist (* speed 1.5))]
(actions/run-action entities
(begin [this screen entities]
(-> entities
(update-in [:room :entities :ego]
#(actions/start-animation screen % :jump))
(assoc-in [:tweens :jump-pos] (utils/tween :jump-pos screen [:room :entities :ego :move-pct] 0.0 1.0 jump-duration :power 2))))
(begin [this screen entities]
(-> entities
(assoc-in [:room :entities :cloud] (assoc (texture "space/cloud.png")
:x (- (get-in entities [:room :entities :ego :x]) 10)
:y (get-in entities [:room :entities :ego :y])
:origin-x 7
:origin-y 7
:scale-x 0.5
:scale-y 0.5
:opacity 0.5
:baseline 240))
(assoc-in [:tweens :cloud-up] (utils/tween :cloud-up screen [:room :entities :cloud :y]
(get-in entities [:room :entities :ego :y])
(+ (get-in entities [:room :entities :ego :y]) 20)
1.0))
(assoc-in [:tweens :cloud-fade] (utils/tween :cloud-fade screen [:room :entities :cloud :opacity]
0.5
0.0
1.0))
(assoc-in [:tweens :cloud-grow] (utils/tween :cloud-grow screen [:room :entities :cloud :scale-y]
0.5
2.5
1.0))
(assoc-in [:tweens :cloud-grow-2] (utils/tween :cloud-grow-2 screen [:room :entities :cloud :scale-x]
0.5
2.5
1.0))
(update-in [:room :entities :ego]
#(actions/start-animation screen % :jump))
(assoc-in [:tweens :jump-pos] (utils/tween :jump-pos screen [:room :entities :ego :move-pct] 0.0 1.0 jump-duration :power 2))))
(continue [this screen entities]
(let [v (vector-2 0 0)
@@ -136,7 +161,7 @@
(actions/do-dialogue entities :blergh "Ha ha ha! Is that the best you can do?"
:blergh "Take this!")
(actions/play-animation entities :blergh :swing)
(actions/walk-straight-to entities :ego [100 45] :anim :squat :override-dir :right :speed 3.0)
(actions/walk-straight-to entities :ego [35 45] :anim :squat :override-dir :right :speed 3.0)
(actions/do-dialogue entities :ego "Ouch!"
:blergh "My turn.")