diff --git a/desktop/resources/cursor.png b/desktop/resources/cursor.png index 13e09844..32d9db4e 100644 Binary files a/desktop/resources/cursor.png and b/desktop/resources/cursor.png differ diff --git a/desktop/src-common/advent/screens/items.clj b/desktop/src-common/advent/screens/items.clj index 940e8110..7919ea86 100644 --- a/desktop/src-common/advent/screens/items.clj +++ b/desktop/src-common/advent/screens/items.clj @@ -38,6 +38,23 @@ (actions/give entities :flask-water-ash) (actions/talk entities :ego "I added the ashes to the water."))) +(defn make-water-and-flies [] + (actions/get-script entities + (actions/remove-item entities :flask-water) + (actions/remove-item entities :flies) + (actions/give entities :flask-water-flies) + (actions/talk entities :ego "I put those flies in the flask."))) + +(defn make-flies-ash [] + (actions/get-script entities + (actions/remove-item entities :flask-water) + (actions/remove-item entities :flask-water-ash) + (actions/remove-item entities :flask-water-flies) + (actions/remove-item entities :ash) + (actions/remove-item entities :flies) + (actions/give entities :flask-flies-ash) + (actions/talk entities :ego "Now it's got the fountain water, flies, and the ashes in it."))) + (def items {:wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}} :mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms @@ -83,9 +100,11 @@ :rope {:name "Rope" :value :rope :cursor :rope} :crowbar {:name "Crowbar" :value :crowbar :cursor :crowbar} :flask-2 {:name "Flask" :value :flask-2 :cursor :flask} - :flask-water {:name "Water from fountain" :value :flask-water :cursor :flask :scripts {:ash (make-water-and-ash)}} - :flask-water-ash {:name "Water and ashes" :value :flask-water-ash :cursor :flask-with-contents} + :flask-water {:name "Water from fountain" :value :flask-water :cursor :flask :scripts {:ash (make-water-and-ash) :flies (make-water-and-flies)}} + :flask-water-ash {:name "Water and ashes" :value :flask-water-ash :cursor :flask-with-contents :scripts {:flies (make-flies-ash)}} + :flask-water-flies {:name "Water and flies" :value :flask-water-flies :cursor :flask-with-contents :scripts {:ash (make-flies-ash)}} + :flask-flies-ash {:name "Water, flies, and ash" :value :flask-flies-ash :cursor :flask-with-contents} :note-1 {:name "Note from Gandarf" :value :note-1 :cursor :note-1} - :ash {:name "Ashes" :value :ash :cursor :ash :scripts {:flask-water (make-water-and-ash)}} + :ash {:name "Ashes" :value :ash :cursor :ash :scripts {:flask-water (make-water-and-ash) :flask-water-flies (make-flies-ash)}} :sack-lunch {:name "Sack lunch" :value :sack-lunch :cursor :sack-lunch} - }) + :flies {:name "Flies" :value :flies :cursor :flies :scripts {:flask-water (make-water-and-flies) :flask-water-ash (make-flies-ash)}}}) diff --git a/desktop/src-common/advent/screens/rooms.clj b/desktop/src-common/advent/screens/rooms.clj index 176f29cd..efd90aa0 100644 --- a/desktop/src-common/advent/screens/rooms.clj +++ b/desktop/src-common/advent/screens/rooms.clj @@ -8,7 +8,7 @@ width (or width (.getRegionWidth region)) height (or height (.getRegionHeight region))] ((zone/box entity-x entity-y (+ entity-x (* width (or 1 scale-x))) (+ entity-y (* height (or scale-y 1)))) x y)))} - (when (:script entity) + (when (or (:scripts entity) (:script entity)) {:get-script (fn [cursor [x y]] (if (= :main cursor) (:script entity) diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index ea199869..47a41e8b 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -239,7 +239,16 @@ :y 175 :anim flies-stand :anim-start 0 - :baseline 240)} + :baseline 240 + :scripts {:sack-lunch (actions/get-script entities + (actions/walk-to entities :ego [168 150] :face :right) + (actions/talk entities :ego "Maybe I can catch some of these flies.") + (actions/remove-item entities :sack-lunch) + (actions/play-animation entities :ego :squat) + (actions/talk entities :ego "I think it's working!") + (actions/play-animation entities :ego :squat) + (actions/give entities :flies) + (actions/talk entities :ego "Hopefully they won't fly out of my backpack."))})} :collision "outside-castle/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) :start-pos [310 80] diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 8acbc7c1..59235969 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -140,12 +140,12 @@ (actions/give entities :flask-2)))) (defn add-wizard-if-necessary [entities] - (if (actions/has-item? entities :flask-water) + (if (actions/has-obtained? entities :flask-water) entities (update-in entities [:room :entities] #(assoc % :wizard (get-in entities [:room :wizard]))))) (defn add-note-if-necessary [entities] - (if (and (actions/has-item? entities :flask-water) + (if (and (actions/has-obtained? entities :flask-water) (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 638b200e..48bff919 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -14,7 +14,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 :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch]) +(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies]) (defn cursor [filename which] (let [scale 2