fading music.
This commit is contained in:
@@ -336,6 +336,9 @@
|
||||
false)))
|
||||
|
||||
(defn transition-background [entities new-background [x y]]
|
||||
(let [old-music (get-in @entities [:room :music])
|
||||
new-music (get-in @entities [:rooms new-background :music])
|
||||
music-changed? (not= old-music new-music)]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
|
||||
@@ -348,7 +351,9 @@
|
||||
:opacity 0.1))))
|
||||
|
||||
(continue [this screen entities]
|
||||
(update-in entities [:transition :opacity] + 0.075))
|
||||
(when music-changed?
|
||||
(music! (get-in entities [:musics old-music]) :set-volume (max (- 1.0 (get-in entities [:transition :opacity])) 0.0)))
|
||||
(update-in entities [:transition :opacity] + 0.05))
|
||||
|
||||
(done? [this screen entities]
|
||||
(>= (get-in entities [:transition :opacity]) 1.0))
|
||||
@@ -370,11 +375,14 @@
|
||||
:when (and v (not= new-music k))]
|
||||
(music! v :stop))
|
||||
(when new-music
|
||||
(music! (get-in entities [:musics new-music]) :set-volume 0)
|
||||
(music! (get-in entities [:musics new-music]) :play)))
|
||||
(-> entities
|
||||
(update-in [:room :entities :ego] #(jump-to screen entities % [x y])))))
|
||||
|
||||
(continue [this screen entities]
|
||||
(when music-changed?
|
||||
(music! (get-in entities [:musics new-music]) :set-volume (max (- 1.0 (get-in entities [:transition :opacity])) 0.0)))
|
||||
(update-in entities [:transition :opacity] - 0.075))
|
||||
|
||||
(done? [this screen entities]
|
||||
@@ -384,7 +392,7 @@
|
||||
(dissoc entities :transition))
|
||||
|
||||
(can-skip? [this screen entities]
|
||||
false)))
|
||||
false))))
|
||||
|
||||
(defn do-dialogue [entities & pairs]
|
||||
(loop [pairs (partition 2 pairs)]
|
||||
|
||||
Reference in New Issue
Block a user