diff --git a/desktop/resources/behindhouse/background.png b/desktop/resources/behindhouse/background.png new file mode 100644 index 00000000..43760ff8 Binary files /dev/null and b/desktop/resources/behindhouse/background.png differ diff --git a/desktop/resources/behindhouse/collision.png b/desktop/resources/behindhouse/collision.png new file mode 100644 index 00000000..b194bf9f Binary files /dev/null and b/desktop/resources/behindhouse/collision.png differ diff --git a/desktop/resources/pickup.mp3 b/desktop/resources/pickup.mp3 index 146fd906..7a8b5604 100644 Binary files a/desktop/resources/pickup.mp3 and b/desktop/resources/pickup.mp3 differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index fcbbb87d..5de0601f 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -72,8 +72,12 @@ (let [delta-x (- target-x from-x) delta-y (- target-y from-y) distance (dist from-x from-y target-x target-y) - moved-x (* 1.5 (/ delta-x distance)) - moved-y (* 1.5 (/ delta-y distance))] + moved-x (if (= 0.0 distance) + 0 + (* 1.5 (/ delta-x distance))) + moved-y (if (= 0.0 distance) + 0 + (* 1.5 (/ delta-y distance)))] (if (< distance 1) (do (swap! targets-left rest) entities) @@ -149,3 +153,24 @@ (put! c entities) entities))) (reset! entities ( entities + (assoc-in [:background] (get-in entities [:backgrounds new-background])) + (assoc-in [:ego :x] x) + (assoc-in [:ego :y] y))) + + (continue [this screen entities] entities) + + (done? [this screen entities] + true) + + (terminate [this screen entities] + (put! c entities) + entities))) + (reset! entities (texture screen sheep) :x 38 :y 160 :baseline 160 :anim sheep) - :background (make-background :interactions - {:door {:box [258 100 281 160] - :script (actions/get-script - entities - (actions/walk-to entities :ego [262 88]) - (actions/talk entities :ego (str "Anyone home?")))} - :sword {:box [274 55 305 88] - :script (actions/get-script - entities - (actions/talk entities :ego (str "It's the coolest sword I've ever seen!")) - (actions/walk-to entities :ego [290 66]) - (actions/talk entities :ego "Maybe I can pull it out."))} - :sheep {:box [38 160 71 181] - :script (actions/get-script - entities - (if ((get-in @entities [:ego :inventory]) :wool) - (actions/talk entities :ego "The sheep has given me enough wool.") - (do (actions/give entities :ego :wool) - (actions/talk entities :ego "I guess his wool is shedding."))))} - :right-dir {:box [300 131 320 224] - :script (actions/get-script - entities - (actions/walk-to entities :ego [319 160])) - :cursor :right} - :up-dir {:box [60 180 224 240] - :script (actions/get-script - entities - (actions/walk-to entities :ego [137 204])) - :cursor :up} - :left-dir {:box [0 40 20 140] - :script (actions/get-script - entities - (actions/walk-to entities :ego [0 80])) - :cursor :left}} - - :layers [(assoc background :x 0 :y 0 :baseline 0) - (assoc house :x 0 :y 0 :baseline 122) - (assoc overdirt :x 0 :y 0 :baseline 240) - (assoc background-trees :x 0 :y 0 :baseline 44)] - :collision "outsidehouse/collision.png" - :scale-fn (scaler-fn-with-baseline 110 0.10 1.00)) + :background (:outside-house backgrounds) :ego (get-ego screen) :fps (assoc (label "0" (color :white) ) :x 5 :baseline 9000) }))