added concept of different background musics.

This commit is contained in:
2014-11-03 22:51:08 -08:00
parent 0390c2bfa5
commit 57a84f5101
8 changed files with 30 additions and 10 deletions

View File

@@ -360,9 +360,17 @@
(run-action entities
(begin [this screen entities]
(let [ego (get-in entities [:room :entities :ego])
old-music (get-in entities [:room :music])
entities (-> entities
(assoc-in [:room] (get-in entities [:rooms new-background]))
(assoc-in [:room :entities :ego] ego))]
(assoc-in [:room :entities :ego] ego))
new-music (get-in entities [:room :music])]
(when (not= new-music old-music)
(doseq [[k v] (:musics entities)
:when (and v (not= new-music k))]
(sound! v :stop))
(when new-music
(sound! (get-in entities [:musics new-music]) :loop 0.30)))
(-> entities
(update-in [:room :entities :ego] #(jump-to screen entities % [x y])))))