diff --git a/desktop/resources/dream/background.png b/desktop/resources/dream/background.png index a2356772..ea0de9e5 100644 Binary files a/desktop/resources/dream/background.png and b/desktop/resources/dream/background.png differ diff --git a/desktop/resources/dream/background.psd b/desktop/resources/dream/background.psd index 891ddd0f..0ec74004 100644 Binary files a/desktop/resources/dream/background.psd and b/desktop/resources/dream/background.psd differ diff --git a/desktop/resources/dream/broom.png b/desktop/resources/dream/broom.png new file mode 100644 index 00000000..76822704 Binary files /dev/null and b/desktop/resources/dream/broom.png differ diff --git a/desktop/resources/dream/cliff.png b/desktop/resources/dream/cliff.png new file mode 100644 index 00000000..1a191229 Binary files /dev/null and b/desktop/resources/dream/cliff.png differ diff --git a/desktop/resources/dream/clouds1.png b/desktop/resources/dream/clouds1.png new file mode 100644 index 00000000..63bbbfd8 Binary files /dev/null and b/desktop/resources/dream/clouds1.png differ diff --git a/desktop/resources/dream/clouds2.png b/desktop/resources/dream/clouds2.png new file mode 100644 index 00000000..0e7dd9cc Binary files /dev/null and b/desktop/resources/dream/clouds2.png differ diff --git a/desktop/resources/dream/corner-l.png b/desktop/resources/dream/corner-l.png new file mode 100644 index 00000000..fbee4842 Binary files /dev/null and b/desktop/resources/dream/corner-l.png differ diff --git a/desktop/resources/dream/corner-r.png b/desktop/resources/dream/corner-r.png new file mode 100644 index 00000000..fa79b1c6 Binary files /dev/null and b/desktop/resources/dream/corner-r.png differ diff --git a/desktop/resources/dream/island.png b/desktop/resources/dream/island.png new file mode 100644 index 00000000..104d44e4 Binary files /dev/null and b/desktop/resources/dream/island.png differ diff --git a/desktop/resources/dream/shovel.png b/desktop/resources/dream/shovel.png new file mode 100644 index 00000000..8f6d649b Binary files /dev/null and b/desktop/resources/dream/shovel.png differ diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 73691ecc..17b308d1 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -10,6 +10,7 @@ [clojure.set :as set] [clojure.string :as str] [play-clj.core :refer :all] + [play-clj.math :refer :all] [play-clj.ui :refer :all] [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) @@ -29,8 +30,21 @@ (defn make [screen] (rooms/make :music :town-1 :interactions {} - :layers [(assoc (texture "dream/background.png") :x 0 :y 0 :baseline 0)] - :entities {:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 240)} + :layers [(assoc (texture "dream/clouds1.png") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1) + (assoc (texture "dream/island.png") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1) + (assoc (texture "dream/cliff.png") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2) + (assoc (texture "dream/background.png") :x 0 :y 0 :baseline 2) + (assoc (texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0) + (assoc (texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)] + :entities {:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241) + :broom (assoc (texture "dream/broom.png") :x 286 :y 122 + :path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true) + :update-fn (partial utils/update-path-location 0.30) + :baseline 240) + :shovel (assoc (texture "dream/shovel.png") :x 33 :y 122 + :path (catmull-rom-spline (map #(apply vector-2* %) [[22 122] [22 128]]) true) + :update-fn (partial utils/update-path-location 0.33) + :baseline 240)} :collision "dream/collision.png" :scale-fn (constantly 1.5) :start-pos [140 55])) diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index acb3d4ac..121aa30d 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -124,6 +124,12 @@ a (catmull-rom-spline! (:path entity) :value-at v pos-f)] (assoc entity :x (vector-2! v :x) :y (vector-2! v :y))))))) +(defn update-path-location [speed screen entities entity] + (let [pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed))) + v (vector-2 0 0) + a (catmull-rom-spline! (:path entity) :value-at v pos-f)] + (assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))) + (defn find-override [entities [x y]] (first (concat (filter #(and ((:mouse-in? %) entities x y) (:override %))