more scripting.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 6.2 KiB |
@@ -1 +1 @@
|
||||
{:sound-volume 59.0, :music-volume 32.0}
|
||||
{:sound-volume 64.0, :music-volume 23.0}
|
||||
@@ -28,26 +28,64 @@
|
||||
(actions/talk entities :ego "I can also pick up stuff by clicking on it.")))
|
||||
|
||||
(defn make [screen]
|
||||
(rooms/make :music :town-1
|
||||
:interactions {}
|
||||
:layers [(assoc (texture "dream/clouds1.png") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1)
|
||||
(assoc (texture "dream/island.png") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1)
|
||||
(assoc (texture "dream/cliff.png") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)
|
||||
(assoc (texture "dream/background.png") :x 0 :y 0 :baseline 2)
|
||||
(assoc (texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0)
|
||||
(assoc (texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
|
||||
(assoc (texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)]
|
||||
:entities {:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241)
|
||||
:sword (assoc (texture "dream/sword.png") :x 144 :y 122 :baseline 139)
|
||||
:broom (assoc (texture "dream/broom.png") :x 286 :y 122
|
||||
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)
|
||||
:update-fn (partial utils/update-path-location 0.30)
|
||||
:baseline 240)
|
||||
:shovel (assoc (texture "dream/shovel.png") :x 33 :y 122
|
||||
:path (catmull-rom-spline (map #(apply vector-2* %) [[22 122] [22 128]]) true)
|
||||
:update-fn (partial utils/update-path-location 0.33)
|
||||
:baseline 240)
|
||||
:sign (assoc (texture "dream/sign.png") :x 229 :y 33 :baseline 207)}
|
||||
:collision "dream/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 40 0.5 1.6)
|
||||
:start-pos [140 55]))
|
||||
(let [fairy-godfather-anim (utils/make-anim "dream/fairy-godfather.png" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
|
||||
fairy-godfather-talk-anim (utils/make-anim "dream/fairy-godfather.png" [63 77] 0.15 [5 6 7 8 7 6])]
|
||||
(rooms/make :music :town-1
|
||||
:interactions {}
|
||||
:layers [(assoc (texture "dream/clouds1.png") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1)
|
||||
(assoc (texture "dream/island.png") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1)
|
||||
(assoc (texture "dream/cliff.png") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)
|
||||
(assoc (texture "dream/background.png") :x 0 :y 0 :baseline 2)
|
||||
(assoc (texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0)
|
||||
(assoc (texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
|
||||
(assoc (texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)]
|
||||
:entities {:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241)
|
||||
:sword (assoc (texture "dream/sword.png")
|
||||
:x 144 :y 122 :baseline 139
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [168 76] :face :left)
|
||||
(actions/do-dialogue entities :ego "Awesome! I'll take this sword and become a knight.")
|
||||
(actions/stop-walking entities :ego :face :right)
|
||||
(actions/do-dialogue entities
|
||||
:fairy-godfather "Tick, I'm not sure that being a knight is right for you."
|
||||
:fairy-godfather "I think you'd be better suited for a more menial job."
|
||||
:ego "Hey! Why can't I be a knight! It's my destiny!"
|
||||
:ego "And plus, knights get all the chicks!"
|
||||
:ego "And this plaque here says that chicks dig knights.")))
|
||||
:broom (assoc (texture "dream/broom.png") :x 286 :y 122
|
||||
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)
|
||||
:update-fn (partial utils/update-path-location 0.30)
|
||||
:baseline 240
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [267 70] :face :right)
|
||||
(actions/talk entities :ego "So do I kill ghouls with this broom?")
|
||||
(actions/stop-walking entities :ego :face :left)
|
||||
(actions/do-dialogue entities :fairy-godfather "Not quite, young Tick."
|
||||
:fairy-godfather "This weapon is used to fight a more persistent foe."
|
||||
:fairy-godfather "Dust and grime!"
|
||||
:fairy-godfather "Take the broom, and cast it into the pit of fate."
|
||||
:fairy-godfather "Then you can fulfill your fate as a janitor.")))
|
||||
:shovel (assoc (texture "dream/shovel.png") :x 33 :y 122
|
||||
:path (catmull-rom-spline (map #(apply vector-2* %) [[22 122] [22 128]]) true)
|
||||
:update-fn (partial utils/update-path-location 0.33)
|
||||
:baseline 240
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [61 72] :face :left)
|
||||
(actions/talk entities :ego "A shovel?")
|
||||
(actions/stop-walking entities :ego :face :right)
|
||||
(actions/do-dialogue entities :fairy-godfather "That's right, young Tick!"
|
||||
:fairy-godfather "A grave-digger is a noble profession!"
|
||||
:fairy-godfather "Take the shovel, and cast it into the pit of fate.")))
|
||||
:sign (assoc (texture "dream/sign.png") :x 229 :y 33 :baseline 207)
|
||||
:fairy-godfather (assoc (animation->texture screen fairy-godfather-anim)
|
||||
:x 200 :y 130
|
||||
:baseline 150
|
||||
:talk fairy-godfather-talk-anim
|
||||
:stand fairy-godfather-anim
|
||||
:anim fairy-godfather-anim :anim-start 0
|
||||
:path (catmull-rom-spline (map #(apply vector-2* %) [[200 130] [200 134]]) true)
|
||||
:update-fn (partial utils/update-path-location 0.2)
|
||||
:script (actions/get-script entities (actions/do-dialogue entities :fairy-godfather "Young Tick, you must choose your destiny!")))}
|
||||
:collision "dream/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 40 0.5 1.6)
|
||||
:start-pos [140 55])))
|
||||
|
||||
@@ -740,13 +740,13 @@
|
||||
:inventory (assoc (texture "inventory.png") :x 278 :y 0 :baseline 9000
|
||||
:mouse-in? (zone/box 278 0 320 42)
|
||||
:opacity 0.8)
|
||||
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 0 :opacity 0.3)}))
|
||||
:fps (assoc (label "" (color :white) ) :x 5 :baseline 0 :opacity 0.3)}))
|
||||
|
||||
:on-render
|
||||
(fn [screen [entities]]
|
||||
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
|
||||
(label! (:fps entities) :set-text (str (game :fps)))
|
||||
(render! screen [(:fps entities) (:inventory entities) (:close entities)])
|
||||
#_(label! (:fps entities) :set-text (str (game :fps)))
|
||||
(render! screen [#_(:fps entities) (:inventory entities) (:close entities)])
|
||||
entities))
|
||||
|
||||
:on-resize
|
||||
|
||||
@@ -132,12 +132,16 @@
|
||||
|
||||
(defn find-override [entities [x y]]
|
||||
(first (concat (filter #(and ((:mouse-in? %) entities x y)
|
||||
|
||||
(:override %))
|
||||
(get-in entities [:room :interactions]))
|
||||
(filter #(and (:mouse-in? %)
|
||||
((:mouse-in? %) entities x y))
|
||||
((:mouse-in? %) entities x y)
|
||||
(not= "ego" (:id %))
|
||||
(:script %))
|
||||
(vals (get-in entities [:room :entities])))
|
||||
(filter #(and ((:mouse-in? %) entities x y))
|
||||
(filter #(and ((:mouse-in? %) entities x y)
|
||||
(:script %))
|
||||
(get-in entities [:room :interactions])))))
|
||||
|
||||
|
||||
@@ -209,6 +213,6 @@
|
||||
(let [last-pos (unproject screen (get-in entities [:cursor :last-pos]))]
|
||||
(if (get-in entities [:state :active?])
|
||||
(if-let [mouse-override (find-override entities last-pos)]
|
||||
(assoc-in entities [:cursor :override] (or (:cursor mouse-override) :active-main))
|
||||
(assoc-in entities [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
|
||||
(assoc-in entities [:cursor :override] nil))
|
||||
entities)))
|
||||
|
||||
Reference in New Issue
Block a user