diff --git a/desktop/resources/cursor.png b/desktop/resources/cursor.png index b1f3bfa5..92337a73 100644 Binary files a/desktop/resources/cursor.png and b/desktop/resources/cursor.png differ diff --git a/desktop/resources/outside-castle/collision.png b/desktop/resources/outside-castle/collision.png index 52b610dc..41878696 100644 Binary files a/desktop/resources/outside-castle/collision.png and b/desktop/resources/outside-castle/collision.png differ diff --git a/desktop/resources/outsidehouse/collision.png b/desktop/resources/outsidehouse/collision.png index c2c63c56..e1397b3e 100644 Binary files a/desktop/resources/outsidehouse/collision.png and b/desktop/resources/outsidehouse/collision.png differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index ca2cfb1a..1c61d877 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -67,6 +67,48 @@ ~@forms)) (reset! ~entities ( entities + (assoc-in [:background :entities target-id :x] final-x) + (assoc-in [:background :entities target-id :y] final-y)) + (update-in entities [:background :entities target-id] + #(start-animation screen + (assoc (jump-to screen entities % [(+ moved-x from-x) (+ moved-y from-y)]) + :facing (cond (< delta-x 0) :left + (> delta-x 0) :right + :else (:facing %))) + :walk + )))))) + + (done? [this screen entities] + (let [{from-x :x from-y :y :keys [left right anim] :as target-entity} (get-in entities [:background :entities target-id])] + (< (dist final-x final-y from-x from-y) 1))) + + (terminate [this screen entities] + (stop screen entities target-id)) + (can-skip? [this screen entities] + false)))) + (defn walk-to [entities target-id [final-x final-y] & [can-skip?]] (let [{start-x :x start-y :y} (get-in @entities [:background :entities target-id]) final-x (int final-x) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 2302adce..d7620cf5 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -322,7 +322,11 @@ (do (actions/give entities :wool) (actions/talk entities :ego "I guess her wool is shedding.")))) :scripts {:wool (actions/get-script entities - (actions/talk entities :ego "She doesn't need it back."))}} + (actions/talk entities :ego "She doesn't need it back.")) + :carrot (actions/get-script entities + (actions/walk-to entities :ego [132 140]) + (actions/talk entities :ego "Come on girl, get the carrot!") + (actions/walk-straight-to entities :sheep [100 150]))}} :right-dir {:box [300 131 320 224] :script (actions/get-script entities @@ -410,6 +414,15 @@ (actions/walk-to entities :ego [310 80]) (actions/transition-background entities :outside-house [0 80])) :cursor :right} + :garden {:box [103 170 178 200] + :script (actions/get-script + entities + (if ((get-in @entities [:state :inventory]) :carrot) + (actions/talk entities :ego "If I steal any more, I might get caught.") + (do + (actions/walk-to entities :ego [128 180]) + (actions/talk entities :ego "Hey! Carrots. No one will notice one missing.") + (actions/give entities :carrot))))} :peddler {:box [110 90 128 146] :script (actions/get-script entities diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 23c113c4..b3c27dfa 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 :talk :right :down :left :up]) +(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up]) (defn cursor [filename which] (let [scale 2