diff --git a/desktop/asset-work/tongue-fight/heart_0.aseprite b/desktop/asset-work/tongue-fight/heart_0.aseprite new file mode 100644 index 00000000..2823ffd4 Binary files /dev/null and b/desktop/asset-work/tongue-fight/heart_0.aseprite differ diff --git a/desktop/asset-work/tongue-fight/heart_0.png b/desktop/asset-work/tongue-fight/heart_0.png index cfc16905..88d236e3 100644 Binary files a/desktop/asset-work/tongue-fight/heart_0.png and b/desktop/asset-work/tongue-fight/heart_0.png differ diff --git a/desktop/asset-work/tongue-fight/heart_1.png b/desktop/asset-work/tongue-fight/heart_1.png new file mode 100644 index 00000000..01364d6c Binary files /dev/null and b/desktop/asset-work/tongue-fight/heart_1.png differ diff --git a/desktop/asset-work/tongue-fight/heart_2.png b/desktop/asset-work/tongue-fight/heart_2.png new file mode 100644 index 00000000..3afe95ab Binary files /dev/null and b/desktop/asset-work/tongue-fight/heart_2.png differ diff --git a/desktop/asset-work/tongue-fight/heart_3.png b/desktop/asset-work/tongue-fight/heart_3.png new file mode 100644 index 00000000..f4c67ae6 Binary files /dev/null and b/desktop/asset-work/tongue-fight/heart_3.png differ diff --git a/desktop/asset-work/tongue-fight/tongue-attack_0.ase b/desktop/asset-work/tongue-fight/tongue-attack_0.ase new file mode 100644 index 00000000..89e5346c Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-attack_0.ase differ diff --git a/desktop/asset-work/tongue-fight/tongue-attack_0.png b/desktop/asset-work/tongue-fight/tongue-attack_0.png new file mode 100644 index 00000000..794d32de Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-attack_0.png differ diff --git a/desktop/asset-work/tongue-fight/tongue-attack_1.png b/desktop/asset-work/tongue-fight/tongue-attack_1.png new file mode 100644 index 00000000..e81c5e79 Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-attack_1.png differ diff --git a/desktop/asset-work/tongue-fight/tongue-attack_2.png b/desktop/asset-work/tongue-fight/tongue-attack_2.png new file mode 100644 index 00000000..d39e4586 Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-attack_2.png differ diff --git a/desktop/asset-work/tongue-fight/tongue-windup_0.ase b/desktop/asset-work/tongue-fight/tongue-windup_0.ase new file mode 100644 index 00000000..2df8a0b3 Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-windup_0.ase differ diff --git a/desktop/asset-work/tongue-fight/tongue-windup_0.png b/desktop/asset-work/tongue-fight/tongue-windup_0.png new file mode 100644 index 00000000..4d863f23 Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-windup_0.png differ diff --git a/desktop/asset-work/tongue-fight/tongue-windup_1.png b/desktop/asset-work/tongue-fight/tongue-windup_1.png new file mode 100644 index 00000000..49a3b778 Binary files /dev/null and b/desktop/asset-work/tongue-fight/tongue-windup_1.png differ diff --git a/desktop/resources/packed/tongue-fight.atlas b/desktop/resources/packed/tongue-fight.atlas index c1f15e66..d1d3a06a 100644 --- a/desktop/resources/packed/tongue-fight.atlas +++ b/desktop/resources/packed/tongue-fight.atlas @@ -1,254 +1,310 @@ tongue-fight.png -size: 512,256 +size: 1024,512 format: RGBA8888 filter: Nearest,Nearest repeat: none background rotate: false - xy: 2, 14 + xy: 2, 270 size: 320, 240 orig: 320, 240 offset: 0, 0 index: -1 hair-0 rotate: false - xy: 442, 160 + xy: 735, 366 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 0 hair-0 rotate: false - xy: 467, 178 + xy: 839, 404 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 1 hair-0 rotate: false - xy: 372, 24 + xy: 853, 434 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 2 hair-0 rotate: false - xy: 428, 128 + xy: 888, 472 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 3 hair-0 rotate: false - xy: 477, 196 + xy: 902, 502 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 4 hair-1 rotate: false - xy: 442, 170 + xy: 276, 226 size: 23, 16 orig: 23, 16 offset: 0, 0 index: 0 hair-1 rotate: false - xy: 372, 34 + xy: 2, 11 size: 23, 16 orig: 23, 16 offset: 0, 0 index: 1 hair-1 rotate: false - xy: 397, 34 + xy: 51, 79 size: 23, 16 orig: 23, 16 offset: 0, 0 index: 2 hair-2 rotate: false - xy: 324, 52 + xy: 2, 55 size: 47, 66 orig: 47, 66 offset: 0, 0 index: 0 hair-2 rotate: false - xy: 428, 188 + xy: 324, 297 size: 47, 66 orig: 47, 66 offset: 0, 0 index: 1 hair-2 rotate: false - xy: 373, 52 + xy: 839, 444 size: 47, 66 orig: 47, 66 offset: 0, 0 index: 2 hair-3 rotate: false - xy: 491, 226 + xy: 276, 216 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 0 hair-3 rotate: false - xy: 32, 4 + xy: 51, 69 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 1 hair-3 rotate: false - xy: 442, 150 + xy: 42, 45 size: 7, 8 orig: 7, 8 offset: 0, 0 index: 2 hair-4 rotate: false - xy: 428, 158 + xy: 373, 335 size: 12, 28 orig: 12, 28 offset: 0, 0 index: 0 hair-4 rotate: false - xy: 477, 226 + xy: 839, 414 size: 12, 28 orig: 12, 28 offset: 0, 0 index: 1 hair-4 rotate: false - xy: 358, 22 + xy: 888, 482 size: 12, 28 orig: 12, 28 offset: 0, 0 index: 2 hair-5 + rotate: false + xy: 350, 285 + size: 8, 10 + orig: 8, 10 + offset: 0, 0 + index: 0 +hair-5 + rotate: false + xy: 373, 323 + size: 8, 10 + orig: 8, 10 + offset: 0, 0 + index: 1 +hair-5 + rotate: false + xy: 387, 353 + size: 8, 10 + orig: 8, 10 + offset: 0, 0 + index: 2 +hair-6 + rotate: false + xy: 350, 277 + size: 4, 6 + orig: 4, 6 + offset: 0, 0 + index: 0 +hair-6 + rotate: false + xy: 360, 289 + size: 4, 6 + orig: 4, 6 + offset: 0, 0 + index: 1 +hair-6 + rotate: false + xy: 373, 315 + size: 4, 6 + orig: 4, 6 + offset: 0, 0 + index: 2 +hair-7 rotate: false xy: 2, 2 - size: 8, 10 - orig: 8, 10 - offset: 0, 0 - index: 0 -hair-5 - rotate: false - xy: 12, 2 - size: 8, 10 - orig: 8, 10 - offset: 0, 0 - index: 1 -hair-5 - rotate: false - xy: 22, 2 - size: 8, 10 - orig: 8, 10 - offset: 0, 0 - index: 2 -hair-6 - rotate: false - xy: 422, 112 - size: 4, 6 - orig: 4, 6 - offset: 0, 0 - index: 0 -hair-6 - rotate: false - xy: 428, 120 - size: 4, 6 - orig: 4, 6 - offset: 0, 0 - index: 1 -hair-6 - rotate: false - xy: 477, 188 - size: 4, 6 - orig: 4, 6 - offset: 0, 0 - index: 2 -hair-7 - rotate: false - xy: 505, 247 size: 5, 7 orig: 5, 7 offset: 0, 0 index: 0 hair-7 rotate: false - xy: 505, 238 + xy: 9, 2 size: 5, 7 orig: 5, 7 offset: 0, 0 index: 1 hair-7 rotate: false - xy: 505, 229 + xy: 16, 2 size: 5, 7 orig: 5, 7 offset: 0, 0 index: 2 hair-8 rotate: false - xy: 451, 162 + xy: 316, 262 size: 6, 6 orig: 6, 6 offset: 0, 0 index: 0 hair-8 rotate: false - xy: 467, 170 + xy: 324, 263 size: 6, 6 orig: 6, 6 offset: 0, 0 index: 1 hair-8 rotate: false - xy: 381, 26 + xy: 91, 115 size: 6, 6 orig: 6, 6 offset: 0, 0 index: 2 hair-9 rotate: false - xy: 428, 138 + xy: 302, 250 size: 12, 18 orig: 12, 18 offset: 0, 0 index: 0 hair-9 rotate: false - xy: 477, 206 + xy: 28, 35 size: 12, 18 orig: 12, 18 offset: 0, 0 index: 1 hair-9 rotate: false - xy: 491, 236 + xy: 77, 103 size: 12, 18 orig: 12, 18 offset: 0, 0 index: 2 heart rotate: false - xy: 324, 18 - size: 32, 32 - orig: 32, 32 + xy: 276, 244 + size: 24, 24 + orig: 24, 24 offset: 0, 0 index: 0 +heart + rotate: false + xy: 2, 29 + size: 24, 24 + orig: 24, 24 + offset: 0, 0 + index: 1 +heart + rotate: false + xy: 51, 97 + size: 24, 24 + orig: 24, 24 + offset: 0, 0 + index: 2 +heart + rotate: false + xy: 324, 271 + size: 24, 24 + orig: 24, 24 + offset: 0, 0 + index: 3 +tongue-attack + rotate: false + xy: 2, 123 + size: 135, 145 + orig: 135, 145 + offset: 0, 0 + index: 0 +tongue-attack + rotate: false + xy: 324, 365 + size: 135, 145 + orig: 135, 145 + offset: 0, 0 + index: 1 +tongue-attack + rotate: false + xy: 139, 123 + size: 135, 145 + orig: 135, 145 + offset: 0, 0 + index: 2 tongue-idle rotate: false - xy: 324, 120 + xy: 735, 376 size: 102, 134 orig: 102, 134 offset: 0, 0 index: 0 +tongue-windup + rotate: false + xy: 461, 365 + size: 135, 145 + orig: 135, 145 + offset: 0, 0 + index: 0 +tongue-windup + rotate: false + xy: 598, 365 + size: 135, 145 + orig: 135, 145 + offset: 0, 0 + index: 1 tongue-fight2.png size: 1024,256 diff --git a/desktop/resources/packed/tongue-fight.png b/desktop/resources/packed/tongue-fight.png index 1e052b81..5d6b042b 100644 Binary files a/desktop/resources/packed/tongue-fight.png and b/desktop/resources/packed/tongue-fight.png differ diff --git a/desktop/src-common/advent/screens/rooms/tongue_fight.clj b/desktop/src-common/advent/screens/rooms/tongue_fight.clj index eaccdb09..f05946a7 100644 --- a/desktop/src-common/advent/screens/rooms/tongue_fight.clj +++ b/desktop/src-common/advent/screens/rooms/tongue_fight.clj @@ -29,8 +29,9 @@ [146 185])] (-> entities (update-in [:room :entities :heart] #(assoc % :opacity 1 :x x :y y)) - (assoc-in [:tweens :heart-y] (tween/tween :heart-y screen [:room :entities :heart :y] y (+ y 10) 0.5 :ease tween/ease-out-cubic)) - (assoc-in [:tweens :heart-opacity] (tween/tween :heart-opacity screen [:room :entities :heart :opacity] 1.0 0.0 0.5 :ease tween/ease-in-cubic)) + (update-in [:room :entities :heart] #(actions/start-animation screen % :beat)) + (assoc-in [:tweens :heart-y] (tween/tween :heart-y screen [:room :entities :heart :y] y (+ y 10) 1.0 :ease tween/ease-out-cubic)) + (assoc-in [:tweens :heart-opacity] (tween/tween :heart-opacity screen [:room :entities :heart :opacity] 1.0 0.0 3.0 :ease tween/ease-in-out-quadratic)) (cause-damage is-player-wound?)))) (defn stop-swing-if-necessary [screen {{{{:keys [anim anim-start] {:keys [tongue-swing]} :left } :ego} :entities} :room :as entities}] @@ -41,13 +42,20 @@ (update-in entities [:room :entities :ego] #(actions/start-animation screen % :tongue-idle)) entities)) -(defn trigger-tongue [screen {{{ - {:keys [state started anim anim-start]} :tongue - {ego-anim :anim {ego-windup :tongue-windup} :left } :ego +(defn trigger-tongue [screen {{{{:keys [state started anim anim-start]} :tongue + {ego-anim :anim ego-anim-start :anim-start {ego-windup :tongue-windup} :left } :ego } :entities :keys [ego-hearts tongue-hearts]} :room :as entities}] (let [time-in-state (- (:total-time screen) (or started (:total-time screen))) + tongue-finished? (animation! anim + :is-animation-finished + (- (:total-time screen) anim-start)) + ego-finished? (animation! ego-anim + :is-animation-finished + (- (:total-time screen) ego-anim-start)) + + is-player-wound? (= ego-anim ego-windup) entities (stop-swing-if-necessary screen entities)] (cond @@ -73,18 +81,18 @@ (and (= state :attack) - (animation! anim - :is-animation-finished - (- (:total-time screen) anim-start))) + tongue-finished?) (-> entities (update-in [:room :entities :tongue] #(actions/start-animation screen % :idle)) - (update-in [:room :entities :tongue] assoc :state :idle :started (:total-time screen))) + (update-in [:room :entities :tongue] assoc :state :idle :started (:total-time screen)) + (update-in [:room :entities :heart] #(actions/start-animation screen % :idle))) (and (= state :windup) - (animation! anim - :is-animation-finished - (- (:total-time screen) anim-start))) + tongue-finished? + (or (not is-player-wound?) + ego-finished?)) + (-> entities (update-in [:room :entities :tongue] #(actions/start-animation screen % :attack)) (update-in [:room :entities :tongue] assoc :state :attack :started (:total-time screen)) @@ -93,14 +101,19 @@ %)) (show-heart screen is-player-wound?)) + (and (= state :idle) + is-player-wound? + ego-finished?) + (update-in entities [:room :entities :ego] #(actions/start-animation screen % :tongue-swing)) + ;; reset timer if you wind up while the tongue is idle (and (= state :idle) is-player-wound?) (assoc-in entities [:room :entities :tongue :started] (:total-time screen)) (and (= state :idle) - (= 1 (rand-int (* 60 3))) - (> time-in-state 3.0) + (= 1 (rand-int (* 60 2))) + (> time-in-state 2.0) (not is-player-wound?)) (-> entities (update-in [:room :entities :tongue] #(actions/start-animation screen % :windup)) @@ -124,10 +137,11 @@ hair-7 (utils/make-anim-seq atlas "hair-7" [5 7] 0.16 [0 1 2 1]) hair-8 (utils/make-anim-seq atlas "hair-8" [6 6] 0.16 [0 1 2 1]) hair-9 (utils/make-anim-seq atlas "hair-9" [12 18] 0.16 [0 1 2 1]) - heart (utils/make-anim-seq atlas "heart" [32 32] 0.16 [0]) + heart (utils/make-anim-seq atlas "heart" [24 24] 0.08 [3]) + beat (utils/make-anim-seq atlas "heart" [24 24] 0.08 [0 1 0 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3]) tongue-idle (utils/make-anim-seq atlas "tongue-idle/tongue-idle" [135 145] 0.16 (range 5)) - tongue-windup (utils/make-anim-seq atlas "tongue-idle/tongue-idle" [135 145] 0.16 [0 0 0 0 0]) - tongue-attack (utils/make-anim-seq atlas "tongue-idle/tongue-idle" [135 145] 0.16 [1 1 1 1])] + tongue-windup (utils/make-anim-seq atlas "tongue-windup" [135 145] 0.16 [0 1 0 1 0 1 0 ]) + tongue-attack (utils/make-anim-seq atlas "tongue-attack" [135 145] 0.08 [0 1 2 2 2 2 2 2 2 2 2 2])] (rooms/make :name "Tongue Fight" @@ -226,6 +240,8 @@ :baseline 320 :opacity 0 :anim heart + :idle heart + :beat beat :anim-start 0) :tongue (assoc (animation->texture screen tongue-idle) :x 186 @@ -239,11 +255,15 @@ :windup tongue-windup :idle tongue-idle :attack tongue-attack + :anim-merges {tongue-idle {:origin-x 23 :origin-y 10} + tongue-windup {:origin-x 23 :origin-y 10} + tongue-attack {:origin-x 119 :origin-y 10} + } :anim-start 0 :state :idle :script (actions/get-script entities - (actions/play-animation entities :ego :tongue-windup)))} + (actions/begin-animation entities :ego :tongue-windup)))} :collision "space/collision.png" :scale-fn (constantly 1.0)