smoke animation.
This commit is contained in:
BIN
desktop/resources/space/cloud.png
Normal file
BIN
desktop/resources/space/cloud.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -37,19 +37,44 @@
|
|||||||
e))
|
e))
|
||||||
|
|
||||||
(defn swing-at-blergh [entities]
|
(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]]))
|
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
|
speed 190.0
|
||||||
jump-duration (/ jump-dist speed)
|
jump-duration (/ jump-dist speed)
|
||||||
swing-dist (utils/dist 195 180 205 45)
|
swing-dist (utils/dist 195 180 205 45)
|
||||||
swing-duration (/ swing-dist (* speed 1.5))]
|
swing-duration (/ swing-dist (* speed 1.5))]
|
||||||
(actions/run-action entities
|
(actions/run-action entities
|
||||||
(begin [this screen entities]
|
(begin [this screen entities]
|
||||||
(-> entities
|
(-> entities
|
||||||
(update-in [:room :entities :ego]
|
(assoc-in [:room :entities :cloud] (assoc (texture "space/cloud.png")
|
||||||
#(actions/start-animation screen % :jump))
|
:x (- (get-in entities [:room :entities :ego :x]) 10)
|
||||||
(assoc-in [:tweens :jump-pos] (utils/tween :jump-pos screen [:room :entities :ego :move-pct] 0.0 1.0 jump-duration :power 2))))
|
: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]
|
(continue [this screen entities]
|
||||||
(let [v (vector-2 0 0)
|
(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?"
|
(actions/do-dialogue entities :blergh "Ha ha ha! Is that the best you can do?"
|
||||||
:blergh "Take this!")
|
:blergh "Take this!")
|
||||||
(actions/play-animation entities :blergh :swing)
|
(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!"
|
(actions/do-dialogue entities :ego "Ouch!"
|
||||||
:blergh "My turn.")
|
:blergh "My turn.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user