changes
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
[advent.screens.rooms.outside-castle :as outside-castle]
|
||||
[advent.screens.rooms.inside-castle :as inside-castle]
|
||||
[advent.actions :as actions]
|
||||
[advent.tween :as tween]
|
||||
[advent.utils :as utils]
|
||||
[clojure.zip :as zip]
|
||||
[play-clj.core :refer :all]
|
||||
@@ -256,6 +257,78 @@
|
||||
(assoc-in entities [:room :entities :lamb :target-x] (rand-nth [30 10 60 70]))
|
||||
entities)))
|
||||
|
||||
|
||||
(defn glad [entities]
|
||||
(actions/run-action entities
|
||||
(begin [this screen entities]
|
||||
(let [current-y (get-in entities [:room :entities :ego :y])
|
||||
to-y (+ current-y 15)]
|
||||
(-> entities
|
||||
(update-in [:room :entities :ego] #(actions/start-animation screen % :glad) )
|
||||
(assoc-in [:tweens :jump] (tween/tween :jump screen [:room :entities :ego :y] current-y to-y 0.3 :ease tween/ease-out-cubic))
|
||||
(assoc-in [:room :entities :glad-jump] (doto (assoc (particle-effect "ego/glad-jump")
|
||||
:x (get-in entities [:room :entities :ego :x])
|
||||
:y (get-in entities [:room :entities :ego :y])
|
||||
:baseline (get-in entities [:room :entities :ego :baseline]))
|
||||
(particle-effect! :reset) (particle-effect! :start)))
|
||||
(assoc-in [:room :entities :cloud] (assoc (texture "space/cloud.png")
|
||||
:x (get-in entities [:room :entities :ego :x])
|
||||
: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] (tween/tween :cloud-up screen [:room :entities :cloud :y]
|
||||
(get-in entities [:room :entities :ego :y])
|
||||
(+ (get-in entities [:room :entities :ego :y]) 10)
|
||||
1.0))
|
||||
(assoc-in [:tweens :cloud-fade] (tween/tween :cloud-fade screen [:room :entities :cloud :opacity]
|
||||
0.5
|
||||
0.0
|
||||
1.0))
|
||||
(assoc-in [:tweens :cloud-grow] (tween/tween :cloud-grow screen [:room :entities :cloud :scale-y]
|
||||
0.5
|
||||
1.0
|
||||
1.0))
|
||||
(assoc-in [:tweens :cloud-grow-2] (tween/tween :cloud-grow-2 screen [:room :entities :cloud :scale-x]
|
||||
0.5
|
||||
1.0
|
||||
1.0)))))
|
||||
|
||||
(continue [this screen entities]
|
||||
(assoc-in entities [:room :entities :glad-jump :y] (+ (get-in entities [:room :entities :ego :y]) 5))
|
||||
)
|
||||
|
||||
(done? [this screen entities]
|
||||
(nil? (get-in entities [:tweens :jump])))
|
||||
|
||||
(terminate [this screen entities]
|
||||
entities)
|
||||
(can-skip? [this screen entities]
|
||||
false))
|
||||
(Thread/sleep 800)
|
||||
(actions/run-action entities
|
||||
(begin [this screen entities]
|
||||
(let [current-y (get-in entities [:room :entities :ego :y])
|
||||
to-y (- current-y 15)]
|
||||
(-> entities
|
||||
(assoc-in [:tweens :jump] (tween/tween :jump screen [:room :entities :ego :y] current-y to-y 0.3 :ease tween/ease-in-cubic)))))
|
||||
|
||||
(continue [this screen entities] entities)
|
||||
|
||||
(done? [this screen entities]
|
||||
(and (nil? (get-in entities [:tweens :jump]))
|
||||
(animation! (actions/find-animation (get-in entities [:room :entities :ego ]) :glad)
|
||||
:is-animation-finished
|
||||
(- (:total-time screen) (get-in entities [:room :entities :ego :anim-start])))))
|
||||
|
||||
(terminate [this screen entities]
|
||||
entities)
|
||||
(can-skip? [this screen entities]
|
||||
false)))
|
||||
|
||||
(defn make [screen]
|
||||
(let [sheep-stand-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
|
||||
sheep-walk-sheet (texture! (texture "outsidehouse/sheep-walk.png") :split 33 21)
|
||||
@@ -339,7 +412,8 @@
|
||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||
(do
|
||||
(actions/talk entities :ego "Come here mama sheep!")
|
||||
(actions/play-animation entities :ego :sigh)
|
||||
(glad entities)
|
||||
|
||||
(actions/talk entities :ego "She's too far away for me to pet her.")))))
|
||||
:scripts #(condp = %
|
||||
:wool (actions/get-script entities
|
||||
|
||||
Reference in New Issue
Block a user