diff --git a/desktop/resources/cursor.png b/desktop/resources/cursor.png index 8132e284..782a841a 100644 Binary files a/desktop/resources/cursor.png and b/desktop/resources/cursor.png differ diff --git a/desktop/resources/ego/grow.png b/desktop/resources/ego/grow.png new file mode 100644 index 00000000..e107234b Binary files /dev/null and b/desktop/resources/ego/grow.png differ diff --git a/desktop/resources/ego/grow.pxa/0.pxi b/desktop/resources/ego/grow.pxa/0.pxi new file mode 100644 index 00000000..1fef209f Binary files /dev/null and b/desktop/resources/ego/grow.pxa/0.pxi differ diff --git a/desktop/resources/ego/grow.pxa/1.pxi b/desktop/resources/ego/grow.pxa/1.pxi new file mode 100644 index 00000000..787e225a Binary files /dev/null and b/desktop/resources/ego/grow.pxa/1.pxi differ diff --git a/desktop/resources/ego/grow.pxa/2.pxi b/desktop/resources/ego/grow.pxa/2.pxi new file mode 100644 index 00000000..eb2eefa8 Binary files /dev/null and b/desktop/resources/ego/grow.pxa/2.pxi differ diff --git a/desktop/resources/ego/grow.pxa/3.pxi b/desktop/resources/ego/grow.pxa/3.pxi new file mode 100644 index 00000000..5caea141 Binary files /dev/null and b/desktop/resources/ego/grow.pxa/3.pxi differ diff --git a/desktop/resources/ego/grow.pxa/CelData.plist b/desktop/resources/ego/grow.pxa/CelData.plist new file mode 100644 index 00000000..f0b74d60 --- /dev/null +++ b/desktop/resources/ego/grow.pxa/CelData.plist @@ -0,0 +1,22 @@ + + + + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + diff --git a/desktop/resources/inside-cafeteria/warriors-stand.png b/desktop/resources/inside-cafeteria/warriors-stand.png new file mode 100644 index 00000000..ac54ac4d Binary files /dev/null and b/desktop/resources/inside-cafeteria/warriors-stand.png differ diff --git a/desktop/src-common/advent/screens/items.clj b/desktop/src-common/advent/screens/items.clj index 7e7e6b66..9e50a60b 100644 --- a/desktop/src-common/advent/screens/items.clj +++ b/desktop/src-common/advent/screens/items.clj @@ -6,6 +6,10 @@ (declare wool) (declare cat-toy) (declare flask-1-with-milk) +(declare slobber) +(declare flask-1-strength) +(declare flask-1-with-cream-of-mushroom) + (def make-cat-toy (actions/get-script entities (actions/remove-item entities stick) @@ -18,8 +22,6 @@ (def carrot {:name "Carrot" :value :carrot :cursor :carrot}) (def flask-1-with-mushrooms {:name "Flask with mushrooms" :value :flask-1-with-mushrooms :cursor :flask-with-contents}) -(def flask-1-with-cream-of-mushroom {:name "Flask with cream of mushrooms soup" :value :flask-1-with-cream-of-mushroom :cursor :flask-with-contents}) - (defn make-cream-of-mushroom [] (actions/get-script entities @@ -32,7 +34,7 @@ (def flask-1-with-milk {:name "Flask with milk" :value :flask-1-with-milk :cursor :flask-with-contents :scripts {:mushrooms (make-cream-of-mushroom)}}) -(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-contents}) +(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-strength}) (def flask-1 {:name "Flask" :value :flask-1 :cursor :flask :scripts {:mushrooms (actions/get-script entities (actions/remove-item entities flask-1) @@ -55,3 +57,16 @@ (def glass-eye {:name "Choicest of glass eyes" :value :glass-eye :cursor :glass-eye}) (def motivational-tapes {:name "Choicest motivational tapes" :value :motivational-tapes :cursor :motivational-tapes}) (def used-earplugs {:name "Choicest used earplugs" :value :used-earplugs :cursor :used-earplugs}) +(def grass {:name "Huge grass" :value :grass :cursor :grass}) + +(defn make-strength-potion [] + (actions/get-script entities + (actions/remove-item entities flask-1-with-cream-of-mushroom) + (actions/remove-item entities slobber) + (actions/give entities flask-1-strength) + (actions/talk entities :ego "It's the completed potion of strength!"))) + +(def slobber {:name "Bull slobber" :value :slobber :cursor :slobber :scripts {:flask-1-with-cream-of-mushroom (make-strength-potion)}}) +(def flask-1-with-cream-of-mushroom {:name "Flask with cream of mushrooms soup" :value :flask-1-with-cream-of-mushroom :cursor :flask-with-contents + :scripts {:slobber (make-strength-potion)}}) + diff --git a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj index 35c28193..37eb05af 100644 --- a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj +++ b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj @@ -9,18 +9,64 @@ [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) +(defn do-warrior-dialogue [entities] + (actions/talk entities :ego "Hey guys!") + (actions/talk entities :warriors "Hark! Good day, young esquire.") + (actions/present-choices entities + {:choices ["Why dost thou speaketh in this manner?" + {:run #(actions/respond entities % + :warriors "`Tis but a tradition!" + :warriors "All knights speaketh in such a manner." + :warriors "As my father instructedeth unto me as a mere lad: " + :warriors "'Son, thou must speaketh in this manner.'" + :warriors "And I asketh unto him:" + :warriors "'But father, why musteth I speaketh in this manner?'" + :warriors "'Yea, my son, for thou art a knight. And thou musteth speaketh in this manner.'" + :warriors "And I toldeth unto him:" + :warriors "'Thou art my father, and I am thy son. Therefore I will speaketh in this manner.'" + :ego "... I think I've got the idea.") + :choices actions/previous-choices} + "Can I be a knight like you guys?" + {:run #(actions/respond entities % + :warriors "We thinketh not, young esquire." + :warriors "You lacketh the strength and vigor required for such a task.") + :choices ["But I'm on a quest to become a knight!" + {:run #(actions/respond entities % + :warriors "Young esquire, thou art valiant in heart. " + :warriors "Departeth henceforth and go hitherto, unto the gym.")} + "I challenge you to a arm wrestling match to prove my strength." + {:run #(actions/respond entities % :warriors "[TODO] You lose.")} + "Something else." + {:choices actions/something-else}] + } + "Goodbye." + {:run #(actions/respond entities % :warriors "Fare thee well, and godspeed.")}]})) + (defn make [screen] - (rooms/make :music :town-1 - :interactions - {:right-dir {:box [300 0 320 120] - :script (actions/get-script - entities - (actions/walk-to entities :ego [319 50]) - (actions/transition-background entities :inside-castle [65 150]) - (actions/walk-to entities :ego [126 80])) - :cursor :right} - } - :layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)] - :entities {} - :collision "inside-cafeteria/collision.png" - :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50))) + (let [warriors-stand-sheet (texture! (texture "inside-cafeteria/warriors-stand.png") :split 66 126) + warriors-stand (animation 0.2 (for [i [0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 2 2 2 2 3 3 3 0 0 0 2 2 2 ]] + (aget warriors-stand-sheet 0 i)))] + (rooms/make :music :town-1 + :interactions + {:right-dir {:box [300 0 320 120] + :script (actions/get-script + entities + (actions/walk-to entities :ego [319 50]) + (actions/transition-background entities :inside-castle [65 150]) + (actions/walk-to entities :ego [126 80])) + :cursor :right} + } + :layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)] + :entities {:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 5 :y 9 :baseline 180 + + :left {:stand (utils/flip warriors-stand) + :talk (utils/flip warriors-stand)} + :right {:stand warriors-stand + :talk warriors-stand} + :facing :right + :script (actions/get-script entities + (do-warrior-dialogue entities) + )) + :stand) } + :collision "inside-cafeteria/collision.png" + :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)))) diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index a1398369..f4bcad67 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -120,6 +120,12 @@ :stand) :steer (assoc (texture "outside-castle/steer.png" ) :x 203 :y 155 :baseline 80 :script (actions/get-script entities - (actions/talk entities :ego "That is one buff bull!")))} + (actions/talk entities :ego "That is one buff bull!")) + :scripts {:grass (actions/get-script entities + (actions/walk-to entities :ego [168 150] :face :right) + (actions/play-animation entities :ego :reach) + (actions/remove-item entities items/grass) + (actions/talk entities :ego "Eww! He slobbered on my hand.") + (actions/give entities items/slobber))})} :collision "outside-castle/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)))) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index cfcd06e3..32f69eb3 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -188,7 +188,7 @@ (actions/give entities items/flask-1-with-milk) (actions/talk entities :ego "Sheeps milk.")) (actions/talk entities :ego "She's too far away."))) - items/flask-1-with-mushrooms (items/make-cream-of-mushroom)} + :flask-1-with-mushrooms (items/make-cream-of-mushroom)} :left {:walk (utils/flip sheep-walk) :stand (utils/flip sheep-stand)} :right {:walk sheep-walk diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index cd6243cb..05925a38 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -83,6 +83,7 @@ stand-sheet (texture! (texture "ego/stand.png") :split 18 36) squat-sheet (texture! (texture "ego/squat.png") :split 18 36) reach-sheet (texture! (texture "ego/reach.png") :split 18 36) + grow-sheet (texture! (texture "ego/grow.png") :split 18 36) cat-toy-sheet (texture! (texture "ego/cat-toy.png") :split 41 50) fire-sheet (texture! (texture "ego/fire.png") :split 18 36) walk-right (animation 0.075 (for [i (range 8)] @@ -107,6 +108,8 @@ (texture (aget fire-sheet 0 i)))) fire-3-anim (animation 0.1 (for [i [0 1 2 2 2 2 3 2 3 2 2 2 4 5 6 7 2 2 2 8 9 10 11 2 2 2 2 2 2 2 2 0]] (texture (aget fire-sheet 0 i)))) + grow (animation 0.1 (for [i [0 2 0 0 0 0 2 0 0 0 2 2 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 1 2 1 2 1 2 1 3 2 3 2 3 2 3]] + (texture (aget grow-sheet 0 i)))) ego {:right {:walk walk-right :stand stand-anim :talk talk-anim @@ -115,6 +118,7 @@ :end-squat end-squat :reach reach-anim :cat-toy cat-toy-anim + :grow grow [:fire 1] fire-1-anim [:fire 2] fire-2-anim [:fire 3] fire-3-anim} @@ -126,6 +130,7 @@ :squat (utils/flip squat-anim) :reach (utils/flip reach-anim) :cat-toy (utils/flip cat-toy-anim) + :grow (utils/flip grow) [:fire 1] (utils/flip fire-1-anim) [:fire 2] (utils/flip fire-2-anim) [:fire 3] (utils/flip fire-3-anim)} @@ -135,15 +140,32 @@ :origin-y 0 :scaled true - #_:mouse-in? #_(fn [entities x y] - (let [{entity-x :x entity-y :y region :object} (get-in entities [:room :entities :ego]) - width (.getRegionWidth region) - height (.getRegionHeight region)] + :mouse-in? (fn [entities x y] + (let [{entity-x :x entity-y :y region :object scale :scale-x} (get-in entities [:room :entities :ego]) + half-width (/ (* (.getRegionWidth region) (or scale 1.0)) 2) + height (* (.getRegionHeight region) (or scale 1.0))] + #_(clojure.pprint/pprint [["point" x y] + ["entity " (- entity-x half-width) entity-y (+ entity-x half-width) (+ entity-y height)]]) - ((zone/box entity-x entity-y (+ entity-x width) (+ entity-y height)) x y))) - #_:get-script #_(fn [cursor [x y]] - (case cursor - items/flask-with-cream-of-mushroom (actions/get-script entities (actions/talk entities :ego "Yuck. I filled it with backwash.")))) + ((zone/box (- entity-x half-width) entity-y (+ entity-x half-width) (+ entity-y height)) x y))) + :get-script (fn [cursor [x y]] + (condp = cursor + items/flask-1-with-cream-of-mushroom (actions/get-script entities (actions/talk entities :ego "Blegh! Gross!")) + items/flask-1-strength (actions/get-script entities + (actions/talk entities :ego "I'll just take a sip!") + (actions/talk entities :ego "Woah! I feel something!!") + (actions/play-animation entities :ego :grow :stop? false)) + items/recipe (actions/get-script entities (actions/do-dialogue entities + :ego "The recipe says:" + :ego "'For strength beyond measure,'" + :ego "'you must mix, at your leisure:'" + :ego "'1. Cream of mushroom soup.'" + :ego "'2. Saliva of the creature whose strength you want to match.'" + :ego "'A word of warning, before you go.'" + :ego "'A sip is all it takes to grow.'" + :ego "'Not more than that do drink,'" + :ego "'Or you'll push your body to the brink.'")) + nil)) :x 150 :y 95 :id "ego"}] (actions/start-animation screen @@ -205,7 +227,7 @@ :inside-fangald (make-music "inside-fangald.ogg")} :state {:object nil :active? true - :inventory [] + :inventory [items/flask-1-strength] :clues #{} :mints-eaten 0} :actions {:object nil diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 00f245ff..0a0d4fda 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -11,7 +11,7 @@ (let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})] (println (:input-x screen) (:input-y screen) "->" x y))) -(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :stool :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs]) +(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :stool :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength]) (defn cursor [filename which] (let [scale 2