diff --git a/desktop/backup.edn b/desktop/backup.edn new file mode 100644 index 00000000..d6d9e782 --- /dev/null +++ b/desktop/backup.edn @@ -0,0 +1 @@ +{:active? true, :coaxed-sheep? true, :convinced-wizard? true, :time :day, :inventory (:mandrake :recipe :frog-legs :flask-1 :ladder :trophy), :seen-intro? true, :wizard-left? false, :clues #{}, :hud-active? false, :current-riddle :done, :last-room :outside-house, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:recipe :frog-legs :flask-1 :mandrake :ladder :carrot :trophy}} \ No newline at end of file diff --git a/desktop/resources/ego/squat.png b/desktop/resources/ego/squat.png index e6934087..0d48f62e 100644 Binary files a/desktop/resources/ego/squat.png and b/desktop/resources/ego/squat.png differ diff --git a/desktop/resources/ego/squat.pxa/3.pxi b/desktop/resources/ego/squat.pxa/3.pxi index 6c6c8de1..763e89b2 100644 Binary files a/desktop/resources/ego/squat.pxa/3.pxi and b/desktop/resources/ego/squat.pxa/3.pxi differ diff --git a/desktop/resources/ego/squat.pxa/5.pxi b/desktop/resources/ego/squat.pxa/5.pxi new file mode 100644 index 00000000..2d8a5d2c Binary files /dev/null and b/desktop/resources/ego/squat.pxa/5.pxi differ diff --git a/desktop/resources/ego/squat.pxa/6.pxi b/desktop/resources/ego/squat.pxa/6.pxi new file mode 100644 index 00000000..92bae810 Binary files /dev/null and b/desktop/resources/ego/squat.pxa/6.pxi differ diff --git a/desktop/resources/ego/squat.pxa/CelData.plist b/desktop/resources/ego/squat.pxa/CelData.plist index 1ff35422..8f638e26 100644 --- a/desktop/resources/ego/squat.pxa/CelData.plist +++ b/desktop/resources/ego/squat.pxa/CelData.plist @@ -22,5 +22,13 @@ duration 1 + + duration + 1 + + + duration + 1 + diff --git a/desktop/resources/inside-house/close-safe.16.wav b/desktop/resources/inside-house/close-safe.16.wav new file mode 100644 index 00000000..67c5a1cb Binary files /dev/null and b/desktop/resources/inside-house/close-safe.16.wav differ diff --git a/desktop/resources/inside-house/close-safe.ogg b/desktop/resources/inside-house/close-safe.ogg new file mode 100644 index 00000000..f0423391 Binary files /dev/null and b/desktop/resources/inside-house/close-safe.ogg differ diff --git a/desktop/resources/inside-house/close-safe.wav b/desktop/resources/inside-house/close-safe.wav new file mode 100644 index 00000000..105610ad Binary files /dev/null and b/desktop/resources/inside-house/close-safe.wav differ diff --git a/desktop/resources/inside-house/open-safe.16.wav b/desktop/resources/inside-house/open-safe.16.wav new file mode 100644 index 00000000..3b148294 Binary files /dev/null and b/desktop/resources/inside-house/open-safe.16.wav differ diff --git a/desktop/resources/inside-house/open-safe.ogg b/desktop/resources/inside-house/open-safe.ogg new file mode 100644 index 00000000..d13ac90f Binary files /dev/null and b/desktop/resources/inside-house/open-safe.ogg differ diff --git a/desktop/resources/inside-house/open-safe.wav b/desktop/resources/inside-house/open-safe.wav new file mode 100644 index 00000000..8f16b875 Binary files /dev/null and b/desktop/resources/inside-house/open-safe.wav differ diff --git a/desktop/resources/outsidehouse/milk.24.wav b/desktop/resources/outsidehouse/milk.24.wav new file mode 100644 index 00000000..e7c487ec Binary files /dev/null and b/desktop/resources/outsidehouse/milk.24.wav differ diff --git a/desktop/resources/outsidehouse/milk.ogg b/desktop/resources/outsidehouse/milk.ogg new file mode 100644 index 00000000..7c06576e Binary files /dev/null and b/desktop/resources/outsidehouse/milk.ogg differ diff --git a/desktop/resources/outsidehouse/milk.wav b/desktop/resources/outsidehouse/milk.wav new file mode 100644 index 00000000..3b4c8e2c Binary files /dev/null and b/desktop/resources/outsidehouse/milk.wav differ diff --git a/desktop/settings.edn b/desktop/settings.edn index 61ad08f4..767db683 100644 --- a/desktop/settings.edn +++ b/desktop/settings.edn @@ -1 +1 @@ -{:sound-volume 0.0, :music-volume 0.0} \ No newline at end of file +{:sound-volume 56.0, :music-volume 56.0} \ No newline at end of file diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 03f25f34..48e29208 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -432,6 +432,14 @@ (can-skip? [this screen entities] false))) +(defn pause-camera [entities] + (update-entities entities #(-> % + (assoc-in [:cam :paused? ] true) + (update-in [:tweens] dissoc :cam-x :cam-y)))) + +(defn resume-camera [entities] + (update-entities entities #(assoc-in % [:cam :paused? ] false))) + (defn begin-animation [entities target-id anim] (run-action entities (begin [this screen entities] diff --git a/desktop/src-common/advent/screens/dialogue.clj b/desktop/src-common/advent/screens/dialogue.clj index 524de336..909d73c1 100644 --- a/desktop/src-common/advent/screens/dialogue.clj +++ b/desktop/src-common/advent/screens/dialogue.clj @@ -16,9 +16,9 @@ [com.badlogic.gdx Screen])) (defn ensure-on-screen [talk] - (let [margin-width (* 0.05 (game :width)) + (let [margin-width (* 0.05 1280) minimum-x margin-width - maximum-x (- (game :width) margin-width) + maximum-x (- 1280 margin-width) label-width (label! talk :get-width) label-right (+ (:x talk) label-width) talk (cond (> label-right maximum-x) (assoc talk :x (- maximum-x label-width)) @@ -63,7 +63,7 @@ [x y] (scene-world->talk-world scene-viewport [source-x source-y]) - talk (assoc (label text style :set-font-scale 1.0 :set-alignment Align/center) + talk (assoc (label text style :set-font-scale scale :set-alignment Align/center) :source-x source-x :source-y source-y ) x (- x (/ (label! talk :get-width) 2)) diff --git a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj index 4649bd29..29c7de35 100644 --- a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj +++ b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj @@ -17,12 +17,14 @@ (defn play-battle [entities anim] (actions/transition-music entities :fight) + (actions/pause-camera entities) (actions/add-entity entities :fight (get-in @entities [:room :fight])) (actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight])) (actions/play-animation entities :hands-fight anim) (actions/transition-music entities nil) (actions/remove-entity entities :hands-fight) - (actions/remove-entity entities :fight)) + (actions/remove-entity entities :fight) + (actions/resume-camera entities)) (defn do-warrior-dialogue [entities] (actions/walk-to entities :ego [150 45] :face :left) diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 7416e91d..40973c64 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -142,6 +142,7 @@ (defn pull-sword [entities] (actions/play-animation entities :ego :reach) + (actions/pause-camera entities) (actions/transition-music entities :pull-sword) (actions/add-entity entities :blackout (get-in @entities [:room :blackout])) (actions/add-entity entities :pull-sword (get-in @entities [:room :pull-sword])) @@ -151,6 +152,7 @@ (actions/remove-entity entities :pull-sword) (actions/remove-entity entities :blackout) (particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion) + (actions/resume-camera entities) (actions/transition-music entities nil) (actions/do-dialogue entities :ego "That was weird." :ego "I have to go show my friends!") diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 41be2501..1e3a9c14 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -36,6 +36,13 @@ (actions/has-obtained? entities :money) (not (actions/has-item? entities :money)))) +(defn walk-to-sheep [entities] + (actions/walk-to entities :ego [154 133]) + (actions/walk-straight-to entities :ego [119 134] :update-baseline? false)) + +(defn leave-sheep [entities] + (actions/walk-straight-to entities :ego [154 133] :update-baseline? false)) + (defn put-something-in-cauldron [item] (condp = item :money (actions/get-script entities @@ -337,13 +344,13 @@ (if (actions/has-item? entities :wool) (actions/talk entities :ego "The sheep has given me enough wool.") (if (is-sheep-close? @entities) - (do (actions/walk-to entities :ego ego-sheep-loc :face :left) + (do (walk-to-sheep entities) (actions/play-animation entities :ego :reach) (actions/give entities :wool) - (actions/talk entities :ego "I guess her wool is shedding.")) + (actions/talk entities :ego "I guess her wool is shedding.") + (leave-sheep entities)) (do (actions/talk entities :ego "Come here mama sheep!") - (actions/glad entities) (actions/play-animation entities :ego :sigh) (actions/talk entities :ego "She's too far away for me to pet her."))))) @@ -351,31 +358,34 @@ :wool (actions/get-script entities (actions/talk entities :ego "She doesn't need it back.")) :grass (actions/get-script entities - (actions/walk-to entities :ego ego-sheep-loc :face :left) + (walk-to-sheep entities) (actions/talk entities :ego "Come on girl, get the grass!") (actions/play-animation entities :ego :reach) (actions/talk entities :ego "I think she's not interested.")) :carrot (actions/get-script entities - (actions/walk-to entities :ego ego-sheep-loc :face :left) + (walk-to-sheep entities) (actions/talk entities :ego "Come on girl, get the carrot!") (actions/walk-straight-to entities :sheep [90 138] :update-baseline? false) (actions/play-animation entities :ego :reach) (actions/remove-item entities :carrot) - (actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true)))) + (actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true))) + (leave-sheep entities)) :flask-1 (actions/get-script entities (if (is-sheep-close? @entities) - (do (actions/walk-to entities :ego ego-sheep-loc :face :left) - (actions/play-animation entities :ego :reach) + (do (walk-to-sheep entities) + (actions/play-animation entities :ego :milk) (actions/remove-item entities :flask-1) (actions/give entities :flask-1-with-milk) - (actions/talk entities :ego "Sheeps milk.")) + (actions/talk entities :ego "Sheeps milk.") + (leave-sheep entities)) (actions/talk entities :ego "She's too far away."))) :flask-1-with-mushrooms (actions/get-script entities (if (is-sheep-close? @entities) - (do (actions/walk-to entities :ego ego-sheep-loc :face :left) - (actions/play-animation entities :ego :reach) - (items/make-cream-of-mushroom entities)) + (do (walk-to-sheep entities) + (actions/play-animation entities :ego :milk) + (items/make-cream-of-mushroom entities) + (leave-sheep entities)) (actions/talk entities :ego "She's too far away."))) nil) :left {:walk (utils/flip sheep-walk) diff --git a/desktop/src-common/advent/screens/safe.clj b/desktop/src-common/advent/screens/safe.clj index bd064115..104e3fd9 100644 --- a/desktop/src-common/advent/screens/safe.clj +++ b/desktop/src-common/advent/screens/safe.clj @@ -18,6 +18,7 @@ (def start-y 83) (defn close [entities] + (screen! @(resolve 'advent.screens.scene/scene) :on-reactivate) (-> entities (assoc :shown? false) @@ -69,6 +70,7 @@ entities)) :show-screen (fn [{:keys [success failure]} [entities]] + (sound! (sound "inside-house/open-safe.ogg") :play (utils/current-sound-volume)) (assoc entities :start-showing? true :button-choices [] @@ -103,7 +105,9 @@ (> x (+ start-x 200)) (< y start-y) (> y (+ start-y 75))) - (close entities)))))) + (do + (sound! (sound "inside-house/close-safe.ogg") :play (utils/current-sound-volume)) + (close entities))))))) :on-resize (fn [{:keys [width height viewport]} entities] (.update viewport width height))) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index ffc554be..dcfd14ba 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -198,6 +198,7 @@ scared-walk (utils/make-anim "ego/scared-walk.png" [16 36] 0.05 (range 6)) sigh (utils/make-anim "ego/sigh.png" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ]) glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)])) + milk (utils/make-anim "ego/squat.png" [18 36] 0.05 [0 1 2 2 3 3 3 3 3 3 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 3 3 3 3 3 3 3 3 3 3 3 2 1 0]) ego {:right {:walk walk-right :stand stand-anim @@ -233,7 +234,8 @@ :scared-talk scared-talk :scared-walk scared-walk :sigh sigh - :glad glad} + :glad glad + :milk milk} :left {:walk (utils/flip walk-right) :stand (utils/flip stand-anim) :talk (utils/flip talk-anim) @@ -259,12 +261,14 @@ :spear (utils/flip spear) :pant (utils/flip pant) :sigh (utils/flip sigh) - :glad (utils/flip glad)} + :glad (utils/flip glad) + :milk (utils/flip milk)} :baseline (- 240 (last start-pos)) :facing :right :origin-x 9 :origin-y 0 :scaled true + :milk-sound (sound "outsidehouse/milk.ogg") :step-sound-1 (sound "ego/step-1.ogg") :step-sound-2 (sound "ego/step-2.ogg") :sigh-sound (sound "ego/sigh.ogg") @@ -338,7 +342,10 @@ 143 [:blink 0.15] 176 [:blink 0.15]} (get-in ego [:left :sigh]) {1 [:sigh-sound 0.4]} - (get-in ego [:right :sigh]) {1 [:sigh-sound 0.4]}} + (get-in ego [:right :sigh]) {1 [:sigh-sound 0.4]} + (get-in ego [:left :milk]) {8 [:milk-sound 1.0]} + (get-in ego [:right :milk]) {8 [:milk-sound 1.0]} + } :anim-merges {(get-in ego [:right :shock]) {:origin-x 15} :default {:origin-x 9}})] (actions/start-animation screen @@ -534,6 +541,7 @@ entities {:rooms rooms :step-particles (assoc (particle-effect "ego/step") :x 100 :y 100 :baseline 241) :cam {:zoom 0.95 + :paused? false :object nil} :musics {:object nil :inside-antique (utils/make-music "inside-antique.ogg") @@ -612,8 +620,9 @@ [id ((:update-fn entity) screen entities entity)] [id entity]))))) - entities (if (and (nil? (get-in entities [:tweens :cam-x])) - (= 1 (rand-int 20))) + entities (if (and (not (get-in entities [:cam :paused?])) + (nil? (get-in entities [:tweens :cam-x])) + (= 1 (rand-int 20))) (if (= (rand-int 2) 1) (actions/pan-to screen entities (get-in entities [:room :entities :ego :x]) @@ -635,12 +644,11 @@ layers (get-layers entities) all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))] - (when (nil? (:zoom (:cam entities))) - (println entities)) (screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen)) - (set! (. camera zoom) (:zoom (:cam entities))) - (set! (.. camera position x) (:x (:cam entities) 160.0)) - (set! (.. camera position y) (:y (:cam entities) 120.0)) + (when (not (get-in entities [:cam :paused?])) + (set! (. camera zoom) (:zoom (:cam entities))) + (set! (.. camera position x) (:x (:cam entities) 160.0)) + (set! (.. camera position y) (:y (:cam entities) 120.0))) (let [entities (utils/update-override screen entities)]