diff --git a/desktop/resources/inside-castle/collision.png b/desktop/resources/inside-castle/collision.png index 93a41064..64484487 100644 Binary files a/desktop/resources/inside-castle/collision.png and b/desktop/resources/inside-castle/collision.png differ diff --git a/desktop/src-common/advent/screens/rooms/behind_house.clj b/desktop/src-common/advent/screens/rooms/behind_house.clj index 4a20d82d..a48c5581 100644 --- a/desktop/src-common/advent/screens/rooms/behind_house.clj +++ b/desktop/src-common/advent/screens/rooms/behind_house.clj @@ -37,7 +37,9 @@ :script (actions/get-script entities (actions/walk-to entities :ego [128 100]) - (actions/talk entities :ego "I can see Fangald moving around in there but it's hard to see at this angle."))}} + (actions/do-dialogue entities + :ego "I can see Gandarf moving around in the corner of the room." + :ego "It's hard to make out from this angle."))}} :layers [(assoc (texture "behindhouse/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "behindhouse/house.png") :x 0 :y 0 :baseline 122) (assoc (texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)] @@ -66,7 +68,8 @@ (actions/talk entities :ego "It looks like the wall is crumbling here.") (actions/play-animation entities :ego :reach) (actions/update-entity entities :peeling #(assoc % :opacity 0)) - (actions/update-state entities (fn [state] (assoc state :opened-crack? true)))))))} + (actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))) + :bird (utils/make-bird screen [[50 235] [80 220] [100 239] [180 235] [85 225]])} :collision "behindhouse/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) :apply-state (fn [entities] diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 141a644a..284e8366 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -4,6 +4,8 @@ [advent.screens.items :as items] [advent.utils :as utils] [clojure.zip :as zip] + [clojure.set :as set] + [clojure.string :as str] [play-clj.core :refer :all] [play-clj.ui :refer :all] [play-clj.utils :refer :all] @@ -26,8 +28,7 @@ (defn nice-trophy-dialogue [entities] {:run #(actions/respond entities % - :game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!" - :game-player "I guess I'm pretty wise." + :game-player "Thanks. I'm the reigning champ in the annual Town of Remington Junior Smarty Pants Derby." :game-player "And with my sharp intellect, I'm guessing you want my trophy?") :choices ["Yes." {:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool))) @@ -41,8 +42,7 @@ :ego "Okay."))} "No." {:run #(actions/respond entities % - :game-player "That's exactly what I'd expect a dummy like you to say.") - }]}) + :game-player "That's exactly what I'd expect a dummy like you to say.")}]}) (defn walk-to-player [entities] (actions/walk-to entities :ego [210 73] :face :right)) @@ -55,16 +55,19 @@ {:run #(actions/respond entities % :game-player "It is said that only he who is worthy in wisdom can pull the sword!" :game-player "I, of course have such wisdom, but I'm still unable to pull it myself.") - :choices ["Can you teach me your ways?" + :choices ["How'd you get to be so wise?" {:run #(actions/respond entities % - :game-player "Ha! My intellect has only been achieved with years of precise training!" - :game-player "You're out of luck, friend. Unless you are willing to spend hours and hours in careful study, you will always be a dunce." - :ego "...") + :game-player "Ever heard of the annual Town of Remington Junior Smarty Pants Derby?" + :ego "I don't think so..." + :game-player "I'm the three times town champ!" + :game-player "My intellect has only been achieved with years of precise training!" + :ego "..." + :game-player "It would take years of careful honing of your skills to be as wise as I am.") :choices actions/previous-choices} - "How come?" + "Why don't you pull the sword?" {:run #(actions/respond entities % :game-player "You must be mighty in strength to pull the sword." - :game-player "And I spend all of my time either playing my game, or at the library.") + :game-player "And I spend all my time studying!") :choices actions/previous-choices} "Something else." {:choices actions/something-else}]} @@ -95,6 +98,32 @@ "Nevermind." {:run #(actions/respond entities % :game-player "See you around.")}]})) + +(defn pull-sword [entities] + (actions/play-animation entities :ego :reach) + (actions/talk entities :ego "I got it! I will become the greatest knight Remington has ever known!")) + +(defn try-to-pull-sword [entities missing-items obtained-items] + (actions/give entities :certificate) + (actions/give entities :medal) + (let [item->proof {:trophy "wisdom" :medal "strength" :certificate "courage"}] + (actions/play-animation entities :ego :reach) + (actions/do-dialogue entities + :ego "I can't pull it out!" + :ego "It looks like there's an enscription here.") + (actions/play-animation entities :ego :squat) + (actions/do-dialogue entities + :ego "The Sword of Blergh with magic sting," + :ego "shall yield to no earthly king." + :ego "Worthy in wisdom, courage, and might," + :ego "only then with sword he'll fight.") + (if (= 3 (count missing-items)) + (actions/do-dialogue entities :ego "I have to prove myself worthy in wisdom, courage, and might!") + (actions/do-dialogue entities :ego (str "I've proven myself in " + (str/join " and " (map item->proof obtained-items)) + ", but still have to prove myself in " + (str/join " and " (map item->proof missing-items)) + "."))))) (defn make [screen] (let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44) game-player-talk (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]] @@ -127,20 +156,35 @@ :script (actions/get-script entities (actions/talk entities :ego "That's the coolest sword I've ever seen!!") (actions/walk-to entities :ego [37 134] :face :left) - (actions/talk entities :ego "Maybe I can pull it out.") - (actions/play-animation entities :ego :reach) - (actions/do-dialogue entities - :ego "I can't pull it out!" - :ego "It looks like there's an enscription here.") - (actions/play-animation entities :ego :squat) - (actions/do-dialogue entities - :ego "The Sword of Blergh with magic sting," - :ego "shall yield to no earthly king." - :ego "Worthy in wisdom, courage, and might," - :ego "only then with sword he'll fight."))} + (actions/talk entities :ego "If I pull it out I can become a great knight!") + (let [missing-items (set/difference #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items])) + obtained-items (set/intersection #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))] + (if (= #{} missing-items) + (pull-sword entities) + (try-to-pull-sword entities missing-items obtained-items)) + ))} :sign {:box [125 140 165 155] :script (actions/get-script entities - (actions/talk entities :ego "Ye Ol' Antique Shoppe."))}} + (actions/talk entities :ego "Ye Ol' Antique Shoppe."))} + :background-houses {:box [84 145 126 180] + :script (actions/get-script entities + (actions/walk-to entities :ego [79 145] :face :right) + (actions/talk entities :ego "Those are just a bunch of townsfolk houses."))} + :mid-house {:box [217 125 250 180] + :script (actions/get-script entities + (actions/do-dialogue entities + :ego "That's Billy Billigan's house." + :ego "He's probably still angry from when I put his dog in the dryer."))} + :frankie-house {:box [251 140 266 160] + :script (actions/get-script entities + (actions/do-dialogue entities + :ego "That's Frankie Rockfist's house." + :ego "The last time I saw him, he socked me one, right in the kisser."))} + :georgia-house {:box [271 150 286 170] + :script (actions/get-script entities + (actions/do-dialogue entities + :ego "That's Georgia McGorgeous' house." + :ego "One day, when I'm a knight, I'll ask her to be my girlfriend."))}} :layers [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "inside-castle/pedestal-overlay.png") :x 0 :y 0 :baseline 135)] :entities {:bird-1 (utils/make-bird screen (as-> [[185 235] @@ -194,7 +238,10 @@ :game-player "You have earned my trophy.") (actions/give entities :trophy) (actions/remove-entity entities :trophy)) - (actions/talk entities :ego "He doesn't need it.")))} + (actions/talk entities :ego "He doesn't need it."))) + :trophy (actions/get-script entities + (walk-to-player entities) + (actions/talk entities :game-player "You can keep the trophy. You've earned it."))} :anim game-player-stand :anim-start 0 :stand game-player-stand diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 3b064ce9..049d6640 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -19,7 +19,7 @@ balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36) balloon-stand (animation 0.25 (for [i [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 1 2]] (aget balloon-sheet 0 i))) - butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1]) + steer-sheet (texture! (texture "outside-castle/steer.png") :split 50 35) steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]] (aget steer-sheet 0 i))) @@ -166,19 +166,7 @@ :bird (utils/make-bird screen (as-> [[82 235] [134 215] [185 235] [165 238] [220 225] [210 230] [250 235]] p (concat p (reverse p)))) - :butterfly (assoc (animation->texture screen butterfly-stand) - :x 161 - :y 218 - :baseline 240 - :anim butterfly-stand - :anim-start 0 - :path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true) - :update-fn (fn [screen entities entity] - (let [speed 0.009 - pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) 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))))) + :flies (assoc (animation->texture screen flies-stand) :x 201 :y 175 diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 3950b376..64670421 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -6,6 +6,7 @@ [clojure.zip :as zip] [play-clj.core :refer :all] [play-clj.ui :refer :all] + [play-clj.math :refer :all] [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) @@ -118,7 +119,8 @@ sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 9 10 (repeat 25 11) (repeat 15 12)])] (aget sheep-stand-sheet 0 i))) sheep-walk (animation 0.05 (for [i (range 6)] - (aget sheep-walk-sheet 0 i)))] + (aget sheep-walk-sheet 0 i))) + butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])] (rooms/make :music :town-2 :interactions {:door {:box [258 100 281 160] @@ -194,7 +196,20 @@ :stand (utils/flip sheep-stand)} :right {:walk sheep-walk :stand sheep-stand}) - sheep-stand)} + sheep-stand) + :butterfly (assoc (animation->texture screen butterfly-stand) + :x 161 + :y 218 + :baseline 240 + :anim butterfly-stand + :anim-start 0 + :path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true) + :update-fn (fn [screen entities entity] + (let [speed 0.009 + pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) 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)))))} :collision "outsidehouse/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) :apply-state (fn [entities]