diff --git a/desktop/src-common/advent/screens/rooms/common.clj b/desktop/src-common/advent/screens/rooms/common.clj index 9778a7d2..0055c98b 100644 --- a/desktop/src-common/advent/screens/rooms/common.clj +++ b/desktop/src-common/advent/screens/rooms/common.clj @@ -335,71 +335,7 @@ :default (actions/get-script entities (actions/do-dialogue entities :frankie "What? Wanting to give up more of your goodies?"))}))) -(defn explode [entities] - (actions/run-action entities - (begin [this screen entities] - - - (-> entities - (update-in [:room :entities :bloodclot] #(actions/start-animation screen % :explode)) - (update-in [:room :entities] dissoc :broken-jewel) - (update-in [:room :entities] dissoc :bloodclot-head) - (assoc-in [:room :entities :ego :facing] :right) - (update-in [:room :entities :ego] #(actions/start-animation screen % :crawl)))) - - (continue [this screen entities] - (if (= 185 (get-in entities [:room :entities :bloodclot :current-frame-index])) - (do (particle-effect! (get-in entities [:room :entities :grow-explode]) :reset) - (particle-effect! (get-in entities [:room :entities :grow-explode]) :start))) - - (let [move-speed (* 0.17 - (/ (:delta-time screen) - (/ 1.0 60.0))) - entities (update-in entities [:room :entities :ego :x] #(max 80 (- % move-speed)))] - (if (= 80 (get-in entities [:room :entities :ego :x])) - (update-in entities [:room :entities :ego] #(actions/start-animation screen % :crawl-hide)) - - entities ))) - - (done? [this screen entities] - (= (get-in entities [:room :entities :bloodclot :current-frame-index]) 191)) - - (terminate [this screen entities] - (-> entities - (update-in [:room :entities] dissoc :bloodclot) - (assoc-in [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 0.0 1.0 0.2 :ease tween/ease-in-cubic)))) - (skip-type [this screen entities] - :none)) - (actions/run-action entities - (begin [this screen entities] - entities) - - (continue [this screen entities] - entities) - - (done? [this screen entities] - (not (get-in entities [:tweens :flash]))) - - (terminate [this screen entities] - entities) - (skip-type [this screen entities] - :none)) - - (actions/run-action entities - (begin [this screen entities] - (assoc-in entities [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 1.0 0.0 4.0 :ease tween/ease-in-cubic))) - - (continue [this screen entities] - entities) - - (done? [this screen entities] - (not (get-in entities [:tweens :flash]))) - - (terminate [this screen entities] - (update-in entities [:room :entities :ego] dissoc :stand-override)) - (skip-type [this screen entities] - :none))) (defn disappear [entities] (actions/run-action entities (begin [this screen entities] @@ -454,25 +390,13 @@ :none))) (defn do-win [entities] - - (actions/do-dialogue entities - :ego "Hey, Bloodclot!" - :ego "I have this potion which will make me as strong as you!" - :bloodclot-head "What?!" - :bloodclot-head "Give it here!") (actions/transition-background entities :space [200 45] :between (fn [s e] (-> e (assoc-in [:room :entities :ego :stand-override] :crawl-stand) (assoc-in [:room :entities :ego :previous-frame-index] -1) (update-in [:room :entities :ego] #(actions/start-animation s % :crawl-stand))) - )) - (actions/do-dialogue entities - :bloodclot-head "Yes!" - :bloodclot-head "Ultimate power is mine!" - :bloodclot-head "If I drink this entire bottle, I'll be as powerful as a god!") - - (explode entities) + )) (actions/play-animation entities :ego :standup) (Thread/sleep 1000) (actions/update-entities entities (fn [e] diff --git a/desktop/src-common/advent/screens/rooms/held.clj b/desktop/src-common/advent/screens/rooms/held.clj index 2e6f4256..5072305a 100644 --- a/desktop/src-common/advent/screens/rooms/held.clj +++ b/desktop/src-common/advent/screens/rooms/held.clj @@ -57,6 +57,98 @@ (actions/get-script entities (actions/talk entities who msg))) +(defn explode [entities] + + (actions/run-action entities + (begin [this screen entities] + + + (-> entities + (update-in [:room :entities :bloodclot] #(actions/start-animation screen % :explode)) + (update-in [:room :entities] dissoc :broken-jewel) + (update-in [:room :entities] dissoc :bloodclot-head) + (assoc-in [:room :entities :ego :facing] :right) + (update-in [:room :entities :ego] #(actions/start-animation screen % :crawl)))) + + (continue [this screen entities] + (if (= 185 (get-in entities [:room :entities :bloodclot :current-frame-index])) + (do (particle-effect! (get-in entities [:room :entities :grow-explode]) :reset) + (particle-effect! (get-in entities [:room :entities :grow-explode]) :start))) + + (let [move-speed (* 0.17 + (/ (:delta-time screen) + (/ 1.0 60.0))) + entities (update-in entities [:room :entities :ego :x] #(max 80 (- % move-speed)))] + (if (= 80 (get-in entities [:room :entities :ego :x])) + (update-in entities [:room :entities :ego] #(actions/start-animation screen % :crawl-hide)) + + entities ))) + + (done? [this screen entities] + (= (get-in entities [:room :entities :bloodclot :current-frame-index]) 191)) + + (terminate [this screen entities] + (-> entities + (assoc-in [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 0.0 1.0 0.2 :ease tween/ease-in-cubic)))) + (skip-type [this screen entities] + :none)) + (actions/run-action entities + (begin [this screen entities] + entities) + + (continue [this screen entities] + entities) + + (done? [this screen entities] + (not (get-in entities [:tweens :flash]))) + + (terminate [this screen entities] + entities) + (skip-type [this screen entities] + :none)) + + (actions/run-action entities + (begin [this screen entities] + (assoc-in entities [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 1.0 0.0 4.0 :ease tween/ease-in-cubic))) + + (continue [this screen entities] + entities) + + (done? [this screen entities] + (not (get-in entities [:tweens :flash]))) + + (terminate [this screen entities] + (update-in entities [:room :entities :ego] dissoc :stand-override)) + (skip-type [this screen entities] + :none))) +(defn give-potion [entities] + (actions/do-dialogue entities + :ego "Hey, Bloodclot!" + :ego "I have this potion which will make me as strong as you!" + :bloodclot-head "What?!" + :bloodclot-head "Give it here!") + (actions/transition-background entities :space [200 45] :between (fn [s e] + (-> e + + (assoc-in [:room :entities :ego :stand-override] :crawl-stand) + (assoc-in [:room :entities :ego :previous-frame-index] -1) + (update-in [:room :entities :ego] #(actions/start-animation s % :crawl-stand))) + )) + (actions/do-dialogue entities + :bloodclot-head "Yes!" + :bloodclot-head "Ultimate power is mine!" + :bloodclot-head "If I drink this entire bottle, I'll be as powerful as a god!" + ) + (explode entities) + + + (actions/do-dialogue entities + :bloodclot "Now..." + :bloodclot "Where were we?") + (actions/transition-background entities :tongue-fight [141 110])) + + + (defn make [screen atlas global-atlas] (let [bloodclot-talk (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7]) bloodclot-stand (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))] @@ -76,7 +168,7 @@ :kiss (fail-item :bloodclot-head "Your bravery won't save you from my belly!") :note-1 (fail-item :bloodclot-head "I'm afraid Gandarf will be of no use to you now.") :note-2 (fail-item :bloodclot-head "I'm afraid Gandarf will be of no use to you now.") - :flask-1-strength (common/win) + :flask-1-strength (actions/get-script entities (give-potion entities)) (actions/get-script entities (actions/talk entities :bloodclot-head "Don't make me laugh, kid!"))) }} @@ -104,5 +196,5 @@ (assoc-in [:room :entities :ego :get-script] (fn [cursor [x y]] (actions/get-script entities (if (= :flask-1-strength (:value cursor)) - (common/do-win entities) + (give-potion entities) (actions/talk entities :ego "I can't reach it!")))))))))) diff --git a/desktop/src-common/advent/screens/rooms/tongue_fight.clj b/desktop/src-common/advent/screens/rooms/tongue_fight.clj index fc828ea9..9e477a9e 100644 --- a/desktop/src-common/advent/screens/rooms/tongue_fight.clj +++ b/desktop/src-common/advent/screens/rooms/tongue_fight.clj @@ -64,9 +64,7 @@ (get-in entities [:state :active?]) (= 0 ego-hearts)) (do - ((actions/get-script entities - (actions/transition-background entities :held [113 120]) - (Thread/sleep 10000)) + ((common/win) entities) entities) @@ -74,9 +72,7 @@ (get-in entities [:state :active?]) (= 0 tongue-hearts)) (do - ((actions/get-script entities - (actions/transition-background entities :cat-tree [113 120]) - (Thread/sleep 10000)) + ((common/win) entities) entities)