added drop sound.

This commit is contained in:
Bryce Covert
2015-10-10 13:24:45 -07:00
parent e830e62421
commit 7c85e01e9b
5 changed files with 23 additions and 10 deletions

View File

@@ -514,8 +514,11 @@
:none)))
(defn play-sound
([entities sound-file vol]
(let [s (sound sound-file)]
([entities sound-file vol & [wait?]]
(let [wait? (if (nil? wait?) true wait?)
s (if (string? sound-file)
(sound sound-file)
sound-file)]
(run-action entities
(begin [this screen entities]
(utils/play-sound! screen entities s (constantly vol)))
@@ -523,9 +526,11 @@
(continue [this screen entities] entities)
(done? [this screen entities]
(not (seq (filter
#(= s (:sound %))
(get-in entities [:current-sounds :value])))))
(if wait?
(not (seq (filter
#(= s (:sound %))
(get-in entities [:current-sounds :value]))))
true))
(terminate [this screen entities]
entities)