diff --git a/desktop/resources/cursor.png b/desktop/resources/cursor.png index 32d9db4e..a80a6ee5 100644 Binary files a/desktop/resources/cursor.png and b/desktop/resources/cursor.png differ diff --git a/desktop/resources/outside-jail/spear.png b/desktop/resources/outside-jail/spear.png new file mode 100644 index 00000000..29c11be5 Binary files /dev/null and b/desktop/resources/outside-jail/spear.png differ diff --git a/desktop/src-common/advent/screens/items.clj b/desktop/src-common/advent/screens/items.clj index 7919ea86..49d1d78b 100644 --- a/desktop/src-common/advent/screens/items.clj +++ b/desktop/src-common/advent/screens/items.clj @@ -107,4 +107,5 @@ :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) :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)}}}) + :flies {:name "Flies" :value :flies :cursor :flies :scripts {:flask-water (make-water-and-flies) :flask-water-ash (make-flies-ash)}} + :spear {:name "Spear" :value :spear :cursor :spear}}) diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index d1147ca4..834f7df1 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -9,10 +9,16 @@ [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) +(defn add-spear-if-necessary [entities] + (if (and (not (actions/has-obtained? entities :spear)) + (get-in entities [:state :dropped-ball?])) + (assoc-in entities [:room :entities :spear] (get-in entities [:room :spear])) + entities)) (defn make-night [entities] (-> entities - (assoc-in [:room :entities :guard] (get-in entities [:room :guard])))) + (assoc-in [:room :entities :guard] (get-in entities [:room :guard])) + add-spear-if-necessary)) (defn search-guard [entities] (actions/walk-to entities :ego [121 75] :face :left) @@ -24,6 +30,13 @@ :ego "Looks like it's pretty mangled from his spill.") (actions/give entities :sack-lunch)))) +(defn grab-spear [entities] + (actions/walk-to entities :ego [76 49] :face :left) + (actions/play-animation entities :ego :reach) + (actions/remove-entity entities :spear) + (actions/give entities :spear) + (actions/talk entities :ego "I guess he won't need this anymore.")) + (defn make [screen] (let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3)) guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87) @@ -99,6 +112,9 @@ :talk guard-talk :sleep guard-sleep :script (actions/get-script entities (search-guard entities)))) + :spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png") + :x 60 :y 65 :baseline 180 + :script (actions/get-script entities (grab-spear entities)))) :collision "outside-jail/collision.png" :scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3) :start-pos [145 15] diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 48bff919..ff5b4b45 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 :flies]) +(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 :spear]) (defn cursor [filename which] (let [scale 2