diff --git a/desktop/gametodos.txt b/desktop/gametodos.txt index afc652f5..49afeae4 100644 --- a/desktop/gametodos.txt +++ b/desktop/gametodos.txt @@ -5,4 +5,5 @@ + Brian O'Brainy animation + proper save/settings file location + closing should stop all scripts -+ frankie should drop coin ++ dialogue for coin drop ++ night gandarf text is bad diff --git a/desktop/src-common/advent/screens/rooms/castle_gate.clj b/desktop/src-common/advent/screens/rooms/castle_gate.clj index 67be9bf6..6a6c1978 100644 --- a/desktop/src-common/advent/screens/rooms/castle_gate.clj +++ b/desktop/src-common/advent/screens/rooms/castle_gate.clj @@ -106,6 +106,14 @@ :origin-x 5 :origin-y 5 :night-profile :none + :update-fn (partial utils/update-path-location 0.5) + :script (actions/get-script entities + (when (get-in @entities [:state :has-dropped-coin?]) + (actions/walk-to entities :ego [196 46] :face :left) + (actions/play-animation entities :ego :squat) + (actions/remove-entity entities :coin-flip) + (actions/give entities :money))) + :walk coin-flip :coinflip coin-flip))) (defn make-goon-1 [screen] @@ -138,12 +146,26 @@ (actions/start-animation s e :stand) e)) :script (actions/get-script entities - (if (= (get-in @entities [:room :entities :coin-flip :opacity]) 1.0) - (actions/update-entities entities - (fn [screen entities] - (let [current-y (get-in entities [:room :entities :coin-flip :y])] - (assoc-in entities [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] current-y 80 0.5 :ease tween/ease-in-cubic)))) - :use-screen? true) + (if (get-in @entities [:tweens :coin-y]) + (do + + (actions/update-entities entities (fn [entities] + (update-in entities [:tweens] dissoc :coin-y))) + + (actions/walk-straight-to entities :coin-flip [212 90] :update-baseline? false :speed 3.0) + + (actions/walk-straight-to entities :coin-flip [210 105] :update-baseline? false :speed 1.0) + (Thread/sleep 50) + (actions/walk-straight-to entities :coin-flip [205 75] :update-baseline? false :speed 1.5) + + (actions/walk-straight-to entities :coin-flip [202 83] :update-baseline? false :speed 1.0) + (Thread/sleep 50) + (actions/walk-straight-to entities :coin-flip [195 65] :update-baseline? false :speed 0.5) + + (actions/walk-straight-to entities :coin-flip [192 70] :update-baseline? false :speed 0.5) + (Thread/sleep 50) + (actions/walk-straight-to entities :coin-flip [185 44] :update-baseline? false :speed 0.5) + (actions/update-state entities (fn [s] (assoc s :has-dropped-coin? true)))) (actions/talk entities :ego "Hey goon!"))) :night-profile :sprite :anim-start 0 @@ -156,15 +178,17 @@ (actions/walk-to entities :ego [245 90])) (defn flip-coin [screen entities] - (-> entities - (update-in [:room :entities :coin-flip] (fn [cf] (-> (actions/start-animation screen cf :coinflip) - (assoc :opacity 1.0)))) - (assoc-in [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] 112 175 0.5 :ease tween/ease-out-cubic - :finish (fn [e] - (assoc-in e [:tweens :coin-y] (tween/tween :coin-y (assoc screen :total-time (+ 0.5 (:total-time screen))) [:room :entities :coin-flip :y] 174 112 0.5 :ease tween/ease-in-cubic + (if (not (get-in entities [:state :has-dropped-coin?])) + (-> entities + (update-in [:room :entities :coin-flip] (fn [cf] (-> (actions/start-animation screen cf :coinflip) + (assoc :opacity 1.0)))) + (assoc-in [:tweens :coin-y] (tween/tween :coin-y screen [:room :entities :coin-flip :y] 112 175 0.5 :ease tween/ease-out-cubic + :finish (fn [e] + (assoc-in e [:tweens :coin-y] (tween/tween :coin-y (assoc screen :total-time (+ 0.5 (:total-time screen))) [:room :entities :coin-flip :y] 174 116 0.5 :ease tween/ease-in-cubic :finish (fn [e] (assoc-in e [:room :entities :coin-flip :opacity] 0.0))))))) - (update-in [:room :entities :goon-2] (fn [g] (-> (actions/start-animation screen g :flip)))))) + (update-in [:room :entities :goon-2] (fn [g] (-> (actions/start-animation screen g :flip))))) + entities)) (defn make [screen] @@ -233,5 +257,13 @@ (actions/has-obtained? entities :walkie-talkies)) (assoc-in entities [:room :entities :walkie-talkies] (get-in entities [:room :walkie-talkies])) + entities) + (if (and (not (actions/has-obtained? entities :money)) + (get-in entities [:state :has-dropped-coin?])) + (do + (update-in entities [:room :entities :coin-flip] assoc :x 185 :y 44 :opacity 1.0)) + entities) + (if (actions/has-obtained? entities :money) + (update-in entities [:room :entities] dissoc :coin-flip) entities))) :start-pos [300 45]))) diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 3ef1e548..ae33d382 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -213,9 +213,7 @@ :ego "No, not the Slinger's Shot!" :frankie "Look like we hit the jackpot tonight boys!") (frankie-comment-on-item entities) - (actions/give entities :money) (actions/do-dialogue entities - :frankie "Here's a little tip for your troubles, Dipstick." :frankie "Bubba, put this stuff in the secret stash." :frankie "Now move along." :frankie "Before we decide to take all of your stuff." diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 5c06d6fa..83131061 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -270,12 +270,12 @@ (actions/give entities :flask-2)))) (defn add-wizard-if-necessary [entities] - (if (actions/has-obtained? entities :money) + (if (get-in entities [:state :seen-frankie?]) entities (update-in entities [:room :entities] #(assoc % :wizard (get-in entities [:room :wizard]))))) (defn add-note-if-necessary [entities] - (if (and (actions/has-obtained? entities :money) + (if (and (get-in entities [:state :seen-frankie?]) (not (actions/has-obtained? entities :note-1))) (update-in entities [:room :entities] #(assoc % :note (get-in entities [:room :note]))) entities)) diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 38c2c7db..2d8bc3da 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -149,10 +149,12 @@ ) (defn update-path-location [speed screen entities entity] - (let [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! (:path entity) :value-at v pos-f)] - (assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))) + (if (:path entity) + (let [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! (:path entity) :value-at v pos-f)] + (assoc entity :x (vector-2! v :x) :y (vector-2! v :y))) + entity)) (defn find-override [entities [x y]] (first (concat (filter #(and ((:mouse-in? %) entities x y) diff --git a/desktop/started-night.edn b/desktop/started-night.edn index 5c9898f5..6a513479 100644 --- a/desktop/started-night.edn +++ b/desktop/started-night.edn @@ -1 +1 @@ -{:active? true, :coaxed-sheep? true, :seen-bloodclot? true, :seen-frankie? true, :plaques-read #{:shovel}, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:note-1 :money :flask-2 :key :rope :crowbar :sword :recipe :kiss :ladder :cat-toy), :seen-intro? true, :wizard-left? false, :dropped-ball? true, :hay-searches 1, :clues #{:name}, :hud-active? false, :allowed-to-keep-teddy? true, :warden-sleeping? true, :current-riddle :done, :warden-fast-asleep? true, :last-room :outside-jail, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:balloon :money :flask-2 :flask-1-with-cream-of-mushroom :key :slingshot :teddy :recipe :mushrooms :rope :flask-1-with-milk :kiss :wool :portrait :slobber :medal :sword :frog-legs :flask-1 :flask-1-strength :dream-sword :mandrake :shovel :cat-toy :grass :stick :motivational-tapes :ladder :carrot :trophy :crowbar :note-1 :flask-1-slobber :ball-n-chain}} \ No newline at end of file +{:active? true, :coaxed-sheep? true, :seen-bloodclot? true, :plaques-read #{:shovel}, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:note-1 :key :rope :crowbar :sword :recipe :kiss :ladder :cat-toy), :seen-intro? true, :wizard-left? false, :dropped-ball? true, :hay-searches 1, :clues #{:name}, :hud-active? false, :allowed-to-keep-teddy? true, :warden-sleeping? true, :current-riddle :done, :warden-fast-asleep? true, :last-room :outside-jail, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:balloon :flask-1-with-cream-of-mushroom :key :slingshot :teddy :recipe :mushrooms :rope :flask-1-with-milk :kiss :wool :portrait :slobber :medal :sword :frog-legs :flask-1 :flask-1-strength :dream-sword :mandrake :shovel :cat-toy :grass :stick :motivational-tapes :ladder :carrot :trophy :crowbar :note-1 :flask-1-slobber :ball-n-chain}}