goon drops coin.
This commit is contained in:
@@ -433,10 +433,12 @@
|
|||||||
(recur (next-choices zipper))
|
(recur (next-choices zipper))
|
||||||
(recur zipper)))))))
|
(recur zipper)))))))
|
||||||
|
|
||||||
(defn update-entities [entities f]
|
(defn update-entities [entities f & {:keys [use-screen?] :or {use-screen? false}}]
|
||||||
(run-action entities
|
(run-action entities
|
||||||
(begin [this screen entities]
|
(begin [this screen entities]
|
||||||
(f entities))
|
(if use-screen?
|
||||||
|
(f screen entities)
|
||||||
|
(f entities)))
|
||||||
(continue [this screen entities] entities)
|
(continue [this screen entities] entities)
|
||||||
(done? [this screen entities] true)
|
(done? [this screen entities] true)
|
||||||
(terminate [this screen entities]
|
(terminate [this screen entities]
|
||||||
|
|||||||
@@ -106,12 +106,7 @@
|
|||||||
:origin-x 5
|
:origin-x 5
|
||||||
:origin-y 5
|
:origin-y 5
|
||||||
:night-profile :none
|
:night-profile :none
|
||||||
:coinflip coin-flip
|
:coinflip coin-flip)))
|
||||||
|
|
||||||
|
|
||||||
#_#_:anim coin-flip
|
|
||||||
#_#_:anim-start 0
|
|
||||||
#_#_:stand coin-flip)))
|
|
||||||
|
|
||||||
(defn make-goon-1 [screen]
|
(defn make-goon-1 [screen]
|
||||||
(let [stand (utils/make-anim "castle-gate/goon-1.png" [12 33] 0.21 [0 0 0 0 0 0 0 0 0 1])]
|
(let [stand (utils/make-anim "castle-gate/goon-1.png" [12 33] 0.21 [0 0 0 0 0 0 0 0 0 1])]
|
||||||
@@ -128,9 +123,11 @@
|
|||||||
(let [stand (utils/make-anim "castle-gate/goon-2.png" [12 32] 0.175 [0 0 0 0 0 0 0 0 0 0 0 0 0 1])
|
(let [stand (utils/make-anim "castle-gate/goon-2.png" [12 32] 0.175 [0 0 0 0 0 0 0 0 0 0 0 0 0 1])
|
||||||
flip (utils/make-anim "castle-gate/goon-2-flip.png" [12 32] 0.05 [1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ])]
|
flip (utils/make-anim "castle-gate/goon-2-flip.png" [12 32] 0.05 [1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ])]
|
||||||
(assoc (animation->texture screen stand)
|
(assoc (animation->texture screen stand)
|
||||||
:x 208 :y 102 :baseline 138
|
:x 214 :y 102 :baseline 138
|
||||||
:scale-x 1.4
|
:scale-x 1.4
|
||||||
:scale-y 1.4
|
:scale-y 1.4
|
||||||
|
:origin-x 6
|
||||||
|
:origin-y 0
|
||||||
:anim stand
|
:anim stand
|
||||||
:flip flip
|
:flip flip
|
||||||
:update-fn (fn [s es e]
|
:update-fn (fn [s es e]
|
||||||
@@ -140,6 +137,14 @@
|
|||||||
(- (:total-time s) (:anim-start e))))
|
(- (:total-time s) (:anim-start e))))
|
||||||
(actions/start-animation s e :stand)
|
(actions/start-animation s e :stand)
|
||||||
e))
|
e))
|
||||||
|
:script (actions/get-script entities
|
||||||
|
(if (= (get-in @entities [:room :entities :coin-flip :opacity]) 1.0)
|
||||||
|
(actions/update-entities entities
|
||||||
|
(fn [screen entities]
|
||||||
|
(let [current-y (get-in entities [:room :entities :coin-flip :y])]
|
||||||
|
(assoc-in entities [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] current-y 80 0.5 :ease tween/ease-in-cubic))))
|
||||||
|
:use-screen? true)
|
||||||
|
(actions/talk entities :ego "Hey goon!")))
|
||||||
:night-profile :sprite
|
:night-profile :sprite
|
||||||
:anim-start 0
|
:anim-start 0
|
||||||
:stand stand)))
|
:stand stand)))
|
||||||
@@ -156,7 +161,7 @@
|
|||||||
(assoc :opacity 1.0))))
|
(assoc :opacity 1.0))))
|
||||||
(assoc-in [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] 112 175 0.5 :ease tween/ease-out-cubic
|
(assoc-in [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] 112 175 0.5 :ease tween/ease-out-cubic
|
||||||
:finish (fn [e]
|
:finish (fn [e]
|
||||||
(assoc-in e [:tweens :coin-y-2] (tween/tween :coin-y-2 (assoc screen :total-time (+ 0.5 (:total-time screen))) [:room :entities :coin-flip :y] 174 112 0.5 :ease tween/ease-in-cubic
|
(assoc-in e [:tweens :coin-y] (tween/tween :coin-y (assoc screen :total-time (+ 0.5 (:total-time screen))) [:room :entities :coin-flip :y] 174 112 0.5 :ease tween/ease-in-cubic
|
||||||
:finish (fn [e]
|
:finish (fn [e]
|
||||||
(assoc-in e [:room :entities :coin-flip :opacity] 0.0)))))))
|
(assoc-in e [:room :entities :coin-flip :opacity] 0.0)))))))
|
||||||
(update-in [:room :entities :goon-2] (fn [g] (-> (actions/start-animation screen g :flip))))))
|
(update-in [:room :entities :goon-2] (fn [g] (-> (actions/start-animation screen g :flip))))))
|
||||||
|
|||||||
@@ -61,5 +61,5 @@
|
|||||||
new-val))]
|
new-val))]
|
||||||
|
|
||||||
(if (= 1.0 pct-done)
|
(if (= 1.0 pct-done)
|
||||||
(update-in (finish e) [:tweens] dissoc id)
|
(finish (update-in e [:tweens] dissoc id))
|
||||||
e)))))
|
e)))))
|
||||||
|
|||||||
Reference in New Issue
Block a user