dream improvements

This commit is contained in:
Bryce Covert
2015-11-14 09:27:12 -08:00
parent 85e9ed084a
commit 4f37232223
5 changed files with 45 additions and 21 deletions

Binary file not shown.

View File

@@ -149,6 +149,7 @@
(actions/update-state entities #(update-in % [:plaques-read] conj :shovel)))
(defn do-intro [entities]
(Thread/sleep 2000)
(actions/talk entities :ego "What's going on?")
@@ -174,6 +175,7 @@
(actions/do-dialogue entities :ego "Huh?")
(actions/talk entities :fairy-godfather "... Tiiiiccckk ...")
(Thread/sleep 500)
(actions/present-choices entities {:choices ["Who is that?"
{:run #(actions/talk entities :ego %)}
"What do you want from me?"
@@ -188,6 +190,7 @@
(fade-in entities)
(actions/transition-music entities :dream :duration 0.25 )
(actions/talk entities :fairy-godfather "-daaaaaaaaaaaaa!")
(Thread/sleep 1500)
(actions/talk entities :ego "Oh no! The grim reaper!" :anim :frustrated-talk)
(actions/do-dialogue entities
@@ -203,6 +206,7 @@
(particle-effect! (get-in @entities [:room :entities :magic]) :start)
(actions/play-animation entities :fairy-godfather :magic)
(fade-in-tools entities)
(Thread/sleep 2500)
@@ -217,23 +221,23 @@
"So I'm destined to be a sword?"
{:run #(actions/talk entities :ego %)}]})
(actions/do-dialogue entities :fairy-godfather "No, no, no!")
(actions/update-entities entities #(update-in % [:room :entities :fairy-godfather] dissoc :path))
(actions/walk-straight-to entities :fairy-godfather [87 120] :speed 1.75 :update-baseline? false)
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[87 120] [87 124]]) true))))
(actions/walk-straight-to entities :fairy-godfather [87 120] :speed 1.5 :update-baseline? false)
(actions/do-dialogue entities :fairy-godfather "This shovel represents the job of gravedigger."
:fairy-godfather "A simple job, for a simple fellow."
:ego "Hey! "
:ego "I'm not simple.")
(actions/update-entities entities #(update-in % [:room :entities :fairy-godfather] dissoc :path))
(actions/walk-straight-to entities :fairy-godfather [260 120] :speed 1.75 :update-baseline? false)
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[260 120] [260 124]]) true))))
(actions/walk-straight-to entities :fairy-godfather [260 120] :speed 1.5 :update-baseline? false)
(actions/do-dialogue entities :fairy-godfather "Next, we have the broom, representing the humble job of a janitor."
:ego "I'm not going to be a janitor!"
:ego "What about that sword?"
:fairy-godfather "Hmm? Sword?")
(actions/update-entities entities #(update-in % [:room :entities :fairy-godfather] dissoc :path))
(actions/walk-straight-to entities :fairy-godfather [192 120] :speed 1.75 :update-baseline? false)
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[192 118] [192 124]]) true))))
(actions/walk-straight-to entities :fairy-godfather [192 120] :speed 1.5 :update-baseline? false)
(actions/do-dialogue entities
:fairy-godfather "Sword...?"
:fairy-godfather "Uh, oh. There must be some mistake."
@@ -283,8 +287,7 @@
(do
((actions/get-script entities
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] dissoc :distracted?)))
(actions/walk-straight-to entities :fairy-godfather [240 120] :speed 3.0 :update-baseline? false :face :left)
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[240 120] [240 124]]) true))))
(actions/walk-straight-to entities :fairy-godfather [192 120] :speed 3.0 :update-baseline? false :face :left)
(actions/do-dialogue entities
:fairy-godfather "Hey! I didn't see anything over there!"
:ego "Oh, yes, it must have flown off."))
@@ -304,7 +307,6 @@
:ego (str "Yes, that's it! There's a " subject " on that island!")
:fairy-godfather "I've got to see it to believe it."
:fairy-godfather "You better not be messing with me, Tick.")
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] dissoc :path)))
(actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :distracted? true :distracted-time 0)))
(actions/walk-straight-to entities :fairy-godfather [211 210] :face :left))
@@ -476,14 +478,29 @@
:plaque-2 (assoc (utils/get-texture "dream/plaque2.png") :x 147 :y 104 :baseline 139 :script (actions/get-script entities (read-sword-plaque entities)))
:plaque-3 (assoc (utils/get-texture "dream/plaque3.png") :x 283 :y 98 :baseline 139 :script (actions/get-script entities (read-broom-plaque entities)))
:outside-particles (common/make-outside-particles)
:bounce-surrogate {:object nil
:path (catmull-rom-spline (map #(apply vector-2* %) [[200 130] [200 150]]) true)
:path-start-time 0
:x 200
:y 130
:delta-y 0
:update-fn (fn [s es e]
(let [y (:y e)
new-y (:y (utils/update-path-location 0.3 s es e))]
(assoc e :delta-y (- new-y y))))
}
:fairy-godfather (assoc (animation->texture screen fairy-godfather-anim)
:x 200 :y 130
:baseline 240
:origin-x 31
:origin-y 0
:scale-x 1.0929411888122558
:scale-y 1.0929411888122558
:test true
:anim fairy-godfather-anim :anim-start 0
:path (catmull-rom-spline (map #(apply vector-2* %) [[200 130] [200 134]]) true)
:path-start-time 0
:scaled true
:magic-sound (utils/load-sound "dream/appear.ogg")
:anim-sound-frames {fairy-godfather-magic-anim {1 [:magic-sound 0.8]}}
@@ -498,9 +515,10 @@
:anim-merges {fairy-godfather-magic-anim {:origin-x 59}
:default {:origin-x 31}}
:facing :left
:update-fn (fn [s es e] (if (:path e)
(utils/update-path-location 0.2 s es e)
e))
:update-fn (fn [s es e]
(if (:distracted? e)
(assoc-in e [:offset-y] 0)
(assoc-in e [:offset-y] (get-in es [:bounce-surrogate :delta-y] 0))))
:script (actions/get-script entities
(if (get-in @entities [:room :entities :fairy-godfather :distracted?])
(actions/do-dialogue entities :ego "He wouldn't be able to hear me from there.")

View File

@@ -957,9 +957,14 @@ void main ()
(.end batch))))
(defn get-rendered [entities e]
(merge e
(when (#{:night :sunrise} (get-in entities [:state :time]))
(get-in entities [:time-profiles (:night-profile e :default)]))))
(as-> e e
(merge e
(when (#{:night :sunrise} (get-in entities [:state :time]))
(get-in entities [:time-profiles (:night-profile e :default)]))
)
(if (:offset-y e)
(assoc e :y (+ (:y e) (:offset-y e)))
e)))
(defn shift-range-to-bounds [x1 x2 min max]

View File

@@ -254,10 +254,11 @@
(defn update-path-location [speed screen entities entity]
(if (:path entity)
(let [pos-f (- (path-point speed screen entities entity) (int (* (- (:total-time screen) (:path-start-time entity 0.0)) speed)))
(let [entity (assoc entity :path-start-time (or (:path-start-time entity) (:total-time screen)))
pos-f (- (path-point speed screen entities entity) (int (* (- (:total-time screen) (:path-start-time entity 0.0)) speed)))
v (vector-2 0 0)
a (catmull-rom-spline! ^CatmullRomSpline (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y) ))
entity))
(defn find-override [entities [x y]]