safe opening sound.
This commit is contained in:
@@ -110,7 +110,7 @@
|
||||
(can-skip? [this screen entities]
|
||||
false))))
|
||||
|
||||
(defn play-animation [entities target-id anim]
|
||||
(defn play-animation [entities target-id anim & {:keys [stop?]}]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
(update-in entities [:room :entities target-id] #(start-animation screen % anim) ))
|
||||
@@ -123,7 +123,9 @@
|
||||
(- (:total-time screen) (get-in entities [:room :entities target-id :anim-start]))))
|
||||
|
||||
(terminate [this screen entities]
|
||||
(stop screen entities target-id))
|
||||
(if (or (nil? stop?) stop?)
|
||||
(stop screen entities target-id)
|
||||
(assoc-in entities [:room :entities target-id :anim] nil)))
|
||||
(can-skip? [this screen entities]
|
||||
false)))
|
||||
|
||||
@@ -196,9 +198,10 @@
|
||||
(defn get-text-duration [text]
|
||||
(* (count (s/split text #" ")) 0.5))
|
||||
|
||||
(defn talk [entities target-id text & {:keys [stop?]}]
|
||||
(defn talk [entities target-id text & {:keys [stop? animate?]}]
|
||||
(let [initial-time (atom nil)
|
||||
stop? (if (nil? stop?) true stop?)]
|
||||
stop? (if (nil? stop?) true stop?)
|
||||
animate? (if (nil? animate?) true animate?)]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
(let [_ (swap! initial-time #(or % (:total-time screen)))
|
||||
@@ -211,7 +214,9 @@
|
||||
:x (get-in entities [:room :entities target-id :x]) :y (+ (get-in entities [:room :entities target-id :y]) height)
|
||||
:target-id target-id
|
||||
:scale scale)
|
||||
(update-in entities [:room :entities target-id ] #(start-animation screen % :talk))))
|
||||
(if animate?
|
||||
(update-in entities [:room :entities target-id ] #(start-animation screen % :talk))
|
||||
entities)))
|
||||
|
||||
(continue [this screen entities] entities)
|
||||
|
||||
@@ -303,6 +308,23 @@
|
||||
(can-skip? [this screen entities]
|
||||
false)))
|
||||
|
||||
(defn play-sound [entities sound-file]
|
||||
(let [m (music sound-file)]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
(music! m :play)
|
||||
entities)
|
||||
|
||||
(continue [this screen entities] entities)
|
||||
|
||||
(done? [this screen entities]
|
||||
(not (music! m :is-playing)))
|
||||
|
||||
(terminate [this screen entities]
|
||||
entities)
|
||||
(can-skip? [this screen entities]
|
||||
false))))
|
||||
|
||||
(defn give [entities item]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
|
||||
Reference in New Issue
Block a user