From bed3c16b27f3c4ce85d7210be289752581cffe3f Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Wed, 4 Mar 2015 07:59:16 -0800 Subject: [PATCH] cleaned up interaction. --- .../advent/screens/rooms/inside_castle.clj | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 81306c55..68fbf27a 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -13,10 +13,16 @@ [play-clj.g2d :refer :all])) (defn get-chorus-volume [entities] (let [ego (get-in entities [:room :entities :ego])] - (if (> (:y ego) 112) - 0.0 - (* (max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0))) - (- 1.0 (get-in entities [:fade :opacity])))))) + (cond (> (:y ego) 112) + 0.0 + (get-in entities [:room :entities :blackout]) + 0.0 + (actions/has-obtained? entities :sword) + 0.0 + :else + (* (max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0))) + (- 1.0 (get-in entities [:fade :opacity])) + (get-in entities [:volume :value] 1.0))))) (defn bloodclot-appear [entities] (actions/run-action entities @@ -135,6 +141,7 @@ (defn pull-sword [entities] (actions/play-animation entities :ego :reach) + (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])) @@ -143,6 +150,7 @@ (actions/remove-entity entities :sword) (actions/remove-entity entities :pull-sword) (actions/remove-entity entities :blackout) + (particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion) (actions/transition-music entities nil) (actions/do-dialogue entities :ego "That was weird." :ego "I have to go show my friends!") @@ -307,14 +315,15 @@ :hotspots [{:box [0 74 77 109] :fn (fn [screen entities] (let [magic (get-in entities [:room :entities :magic])] - (cond (nil? magic) + (cond (actions/has-obtained? entities :sword) + entities + (nil? magic) (do (assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic") - (particle-effect! :reset) - ) - :x 25 - :y 108 - :baseline 240))) + (particle-effect! :reset)) + :x 25 + :y 108 + :baseline 238))) (particle-effect! magic :is-complete) (do (doto magic @@ -441,6 +450,10 @@ (assoc-in [:room :chorus :sound] chorus) (assoc-in [:room :chorus :instance] instance))))) :update-fn (fn [screen entities] + #_(when (and (actions/has-obtained? entities :sword) + (get-in entities [:room :entities :magic]) + (particle-effect! (get-in entities [:room :entities :magic]) :is-complete)) + ) (let [chorus-volume (get-chorus-volume entities)] (if (= 0.0 chorus-volume) (if (get-in entities [:room :chorus :instance])