diff --git a/desktop/resources/behindhouse/house-cover.png b/desktop/resources/behindhouse/house-cover.png new file mode 100644 index 00000000..c537ef5e Binary files /dev/null and b/desktop/resources/behindhouse/house-cover.png differ diff --git a/desktop/resources/behindhouse/house.png b/desktop/resources/behindhouse/house.png index 993cd89a..6b907882 100644 Binary files a/desktop/resources/behindhouse/house.png and b/desktop/resources/behindhouse/house.png differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 47741222..977aa4d2 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -125,7 +125,19 @@ (terminate [this screen entities] (stop screen entities target-id)) (can-skip? [this screen entities] - false))) + false))) + +(defn update-entity [entities target-id f] + (run-action entities + (begin [this screen entities] + (update-in entities [:room :entities target-id] f)) + + (continue [this screen entities] entities) + + (done? [this screen entities] true) + + (terminate [this screen entities] entities) + (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 [:room :entities target-id]) diff --git a/desktop/src-common/advent/screens/rooms/behind_house.clj b/desktop/src-common/advent/screens/rooms/behind_house.clj index 5d333e51..812e86b5 100644 --- a/desktop/src-common/advent/screens/rooms/behind_house.clj +++ b/desktop/src-common/advent/screens/rooms/behind_house.clj @@ -18,19 +18,10 @@ (actions/transition-background entities :outside-house [244 150]) (actions/walk-to entities :ego [195 140])) :cursor :left} - :crack {:box [68 100 73 114] - :script (actions/get-script - entities - (actions/walk-to entities :ego [70 80]) - (actions/play-animation entities :ego :squat) - (actions/talk entities :ego "I can see Gandarf, the wizard inside.") - - (actions/play-animation entities :ego :squat) - (actions/talk entities :ego "It looks like he's opening his Magi-safe.") - (actions/play-animation entities :ego :squat) - (actions/talk entities :ego "[todo: sounds play.]") - (actions/play-animation entities :ego :squat) - (actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there."))} + #_:crack #_{:box [68 100 73 114] + :script (actions/get-script + entities + )} :mushrooms {:box [247 59 269 76] :script (actions/get-script entities @@ -57,6 +48,24 @@ (actions/remove-entity entities :stick) (actions/give entities items/stick) (actions/talk entities :ego "This stick might be useful.") - ))} + )) + :peeling (assoc (texture "behindhouse/house-cover.png") + :x 60 :y 92 :baseline 148 + :script (actions/get-script entities + (if (get-in @entities [:state :opened-crack?]) + (do (actions/walk-to entities :ego [70 80]) + (actions/play-animation entities :ego :squat) + (actions/talk entities :ego "I can see Gandarf, the wizard inside.") + (actions/play-animation entities :ego :squat) + (actions/talk entities :ego "It looks like he's opening his Magi-safe.") + (actions/play-animation entities :ego :squat) + (actions/talk entities :ego "[todo: sounds play.]") + (actions/play-animation entities :ego :squat) + (actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")) + (do (actions/walk-to entities :ego [80 80]) + (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)))))))} :collision "behindhouse/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)))