cleaned up interaction.
This commit is contained in:
@@ -13,10 +13,16 @@
|
|||||||
[play-clj.g2d :refer :all]))
|
[play-clj.g2d :refer :all]))
|
||||||
(defn get-chorus-volume [entities]
|
(defn get-chorus-volume [entities]
|
||||||
(let [ego (get-in entities [:room :entities :ego])]
|
(let [ego (get-in entities [:room :entities :ego])]
|
||||||
(if (> (:y ego) 112)
|
(cond (> (:y ego) 112)
|
||||||
0.0
|
0.0
|
||||||
(* (max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0)))
|
(get-in entities [:room :entities :blackout])
|
||||||
(- 1.0 (get-in entities [:fade :opacity]))))))
|
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]
|
(defn bloodclot-appear [entities]
|
||||||
(actions/run-action entities
|
(actions/run-action entities
|
||||||
@@ -135,6 +141,7 @@
|
|||||||
|
|
||||||
(defn pull-sword [entities]
|
(defn pull-sword [entities]
|
||||||
(actions/play-animation entities :ego :reach)
|
(actions/play-animation entities :ego :reach)
|
||||||
|
|
||||||
(actions/transition-music entities :pull-sword)
|
(actions/transition-music entities :pull-sword)
|
||||||
(actions/add-entity entities :blackout (get-in @entities [:room :blackout]))
|
(actions/add-entity entities :blackout (get-in @entities [:room :blackout]))
|
||||||
(actions/add-entity entities :pull-sword (get-in @entities [:room :pull-sword]))
|
(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 :sword)
|
||||||
(actions/remove-entity entities :pull-sword)
|
(actions/remove-entity entities :pull-sword)
|
||||||
(actions/remove-entity entities :blackout)
|
(actions/remove-entity entities :blackout)
|
||||||
|
(particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion)
|
||||||
(actions/transition-music entities nil)
|
(actions/transition-music entities nil)
|
||||||
(actions/do-dialogue entities :ego "That was weird."
|
(actions/do-dialogue entities :ego "That was weird."
|
||||||
:ego "I have to go show my friends!")
|
:ego "I have to go show my friends!")
|
||||||
@@ -307,14 +315,15 @@
|
|||||||
:hotspots [{:box [0 74 77 109]
|
:hotspots [{:box [0 74 77 109]
|
||||||
:fn (fn [screen entities]
|
:fn (fn [screen entities]
|
||||||
(let [magic (get-in entities [:room :entities :magic])]
|
(let [magic (get-in entities [:room :entities :magic])]
|
||||||
(cond (nil? magic)
|
(cond (actions/has-obtained? entities :sword)
|
||||||
|
entities
|
||||||
|
(nil? magic)
|
||||||
(do
|
(do
|
||||||
(assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic")
|
(assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic")
|
||||||
(particle-effect! :reset)
|
(particle-effect! :reset))
|
||||||
)
|
:x 25
|
||||||
:x 25
|
:y 108
|
||||||
:y 108
|
:baseline 238)))
|
||||||
:baseline 240)))
|
|
||||||
(particle-effect! magic :is-complete)
|
(particle-effect! magic :is-complete)
|
||||||
(do
|
(do
|
||||||
(doto magic
|
(doto magic
|
||||||
@@ -441,6 +450,10 @@
|
|||||||
(assoc-in [:room :chorus :sound] chorus)
|
(assoc-in [:room :chorus :sound] chorus)
|
||||||
(assoc-in [:room :chorus :instance] instance)))))
|
(assoc-in [:room :chorus :instance] instance)))))
|
||||||
:update-fn (fn [screen entities]
|
: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)]
|
(let [chorus-volume (get-chorus-volume entities)]
|
||||||
(if (= 0.0 chorus-volume)
|
(if (= 0.0 chorus-volume)
|
||||||
(if (get-in entities [:room :chorus :instance])
|
(if (get-in entities [:room :chorus :instance])
|
||||||
|
|||||||
Reference in New Issue
Block a user