sounds are now updated every frame.

This commit is contained in:
Bryce Covert
2015-10-07 17:29:53 -07:00
parent 8e12d2df0b
commit b87b8aa171
6 changed files with 88 additions and 38 deletions

View File

@@ -93,9 +93,6 @@
(actions/walk-straight-to entities :ego [142 96])
(actions/talk entities :ego "This must be Frankie Rockfist's secret stash!")))
(defn fountain-vol [entities]
(utils/proximity-volume entities [172 120] :scale 0.5))
(defn make [screen]
(let [guard-sheet (texture! (utils/get-texture "inside-cafeteria/ladder-guard.png") :split 37 87)
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
@@ -281,21 +278,13 @@
:scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3)
:start-pos [145 15]
:update-fn (fn [_ entities]
(when-let [fountain-sound-id (get-in entities [:room :fountain-sound :id])]
(sound! (get-in entities [:room :fountain-sound :sound]) :set-volume fountain-sound-id (fountain-vol entities)))
entities)
:stop-fn (fn [_ entities]
(when-let [fountain-sound-id (get-in entities [:room :fountain-sound :id])]
(sound! (get-in entities [:room :fountain-sound :sound]) :stop fountain-sound-id))
entities)
:apply-state (fn [_ entities]
:apply-state (fn [screen entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(assoc-in entities [:room :fountain-sound :id] (sound! (get-in entities [:room :fountain-sound :sound]) :loop (fountain-vol entities)))
(utils/play-sound! screen entities (get-in entities [:room :fountain-sound :sound])
:fountain 0.5 [172 120] :loop)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
(update-in entities [:room :entities] dissoc :candle-aura :candle-flame))