multiple scritps, pt 3
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
entities)
|
||||
|
||||
:on-talk
|
||||
(fn [{:keys [create-talk target-id color text x y scale scene-viewport] :as screen} [entities]]
|
||||
(fn [{:keys [create-talk target-id color text x y scale scene-viewport id] :as screen} [entities]]
|
||||
(let [font (bitmap-font "ego/font.fnt" )
|
||||
p (NinePatchEntity. (skin! (skin "ui/ui.json") :get-patch "ui-bg"))
|
||||
_ (nine-patch! p :set-padding 25 25 5 15)
|
||||
@@ -71,25 +71,30 @@
|
||||
:source-x source-x :source-y source-y
|
||||
)
|
||||
x (- x (/ (label! talk :get-width) 2))
|
||||
talk (assoc talk :x x :y y)
|
||||
talk (assoc talk :x x :y y :id id)
|
||||
talk (ensure-on-screen talk)]
|
||||
|
||||
(assoc entities :dialogue talk)))
|
||||
(assoc entities id talk)))
|
||||
|
||||
:on-update-camera
|
||||
(fn [{:keys [scene-viewport scene-camera viewport] :as screen} [ {:keys [dialogue] :as entities}]]
|
||||
(when dialogue
|
||||
(let [[x y] (scene-world->talk-world scene-viewport [(:source-x dialogue)
|
||||
(:source-y dialogue)])]
|
||||
(-> entities
|
||||
(assoc-in [:dialogue :x] (- x (/ (label! dialogue :get-width) 2)))
|
||||
(assoc-in [:dialogue :y] y)
|
||||
(update-in [:dialogue] ensure-on-screen)
|
||||
))))
|
||||
(fn [{:keys [scene-viewport scene-camera viewport] :as screen} [ entities]]
|
||||
(reduce-kv (fn [entities id e]
|
||||
(if (:id e)
|
||||
(let [[x y] (scene-world->talk-world scene-viewport [(:source-x e)
|
||||
(:source-y e)])]
|
||||
(-> entities
|
||||
(assoc-in [id :x] (- x (/ (label! e :get-width) 2)))
|
||||
(assoc-in [id :y] y)
|
||||
(update-in [id] ensure-on-screen)))
|
||||
entities))
|
||||
entities
|
||||
entities)
|
||||
|
||||
)
|
||||
|
||||
:stop-talk
|
||||
(fn [{:keys [target-id] } [entities]]
|
||||
(dissoc entities :dialogue))
|
||||
(fn [{:keys [id] } [entities]]
|
||||
(dissoc entities (or id :fg-actions)))
|
||||
|
||||
|
||||
:on-resize (fn [{:keys [viewport width height]} entities]
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
(update-in entities [:tweens] dissoc :coin-y)))
|
||||
|
||||
(actions/walk-straight-to entities :coin-flip [212 90] :update-baseline? false :speed 3.0)
|
||||
(screen! dialogue/talking-screen :stop-talk :target-id :ego)
|
||||
(screen! dialogue/talking-screen :stop-talk)
|
||||
(actions/do-stop entities :ego)
|
||||
|
||||
(actions/walk-straight-to entities :coin-flip [210 105] :update-baseline? false :speed 1.0)
|
||||
|
||||
Reference in New Issue
Block a user