improving font.
This commit is contained in:
@@ -651,3 +651,73 @@
|
||||
(defn respond [entities line & more]
|
||||
(apply do-dialogue entities :ego line more))
|
||||
|
||||
(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.1 :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)))
|
||||
|
||||
@@ -56,15 +56,16 @@
|
||||
tr (bitmap-font! font :get-region)
|
||||
scale (or (min (max scale 0.75) 1) 1)
|
||||
tx (.getTexture tr)
|
||||
_ (texture! tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
_ (texture! tx :set-filter Texture$TextureFilter/Nearest Texture$TextureFilter/Nearest)
|
||||
style (style :label font color)
|
||||
#__ #_(set! (.background style) bg)
|
||||
[source-x source-y] [x y]
|
||||
|
||||
[x y] (scene-world->talk-world scene-viewport [source-x
|
||||
source-y])
|
||||
talk (assoc (label text style :set-font-scale scale :set-alignment Align/center)
|
||||
:source-x source-x :source-y source-y)
|
||||
talk (assoc (label text style :set-font-scale 1.0 :set-alignment Align/center)
|
||||
:source-x source-x :source-y source-y
|
||||
)
|
||||
x (- x (/ (label! talk :get-width) 2))
|
||||
talk (assoc talk :x x :y y)
|
||||
talk (ensure-on-screen talk)]
|
||||
@@ -79,7 +80,8 @@
|
||||
(-> entities
|
||||
(assoc-in [:dialogue :x] (- x (/ (label! dialogue :get-width) 2)))
|
||||
(assoc-in [:dialogue :y] y)
|
||||
(update-in [:dialogue] ensure-on-screen)))))
|
||||
(update-in [:dialogue] ensure-on-screen)
|
||||
))))
|
||||
|
||||
:stop-talk
|
||||
(fn [{:keys [target-id] } [entities]]
|
||||
|
||||
@@ -398,6 +398,7 @@
|
||||
:game-player "Take it, and go in wisdom.")
|
||||
(actions/give entities :trophy)
|
||||
(actions/remove-entity entities :trophy)
|
||||
(actions/glad entities)
|
||||
(actions/talk entities :ego "Thanks!"))
|
||||
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")))
|
||||
:trophy (actions/get-script entities
|
||||
|
||||
@@ -258,76 +258,7 @@
|
||||
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)
|
||||
@@ -412,7 +343,8 @@
|
||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||
(do
|
||||
(actions/talk entities :ego "Come here mama sheep!")
|
||||
(glad entities)
|
||||
(actions/glad entities)
|
||||
(actions/play-animation entities :ego :sigh)
|
||||
|
||||
(actions/talk entities :ego "She's too far away for me to pet her.")))))
|
||||
:scripts #(condp = %
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
scared-talk (utils/make-anim "ego/scared.png" [18 36] 0.05 [0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3])
|
||||
scared-walk (utils/make-anim "ego/scared-walk.png" [16 36] 0.05 (range 6))
|
||||
sigh (utils/make-anim "ego/sigh.png" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ])
|
||||
glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 10 [5 5 6]) (repeat 20 0)]))
|
||||
glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)]))
|
||||
|
||||
ego {:right {:walk walk-right
|
||||
:stand stand-anim
|
||||
|
||||
Reference in New Issue
Block a user