fixing skipped frame issue
This commit is contained in:
@@ -911,12 +911,22 @@
|
||||
(assoc-in [:fade :opacity] 1.0)))
|
||||
entities))
|
||||
|
||||
(defn get-necessary-sound [anim-sound-frames previous-frame-index current-frame-index]
|
||||
(loop [x (inc previous-frame-index)]
|
||||
(cond
|
||||
(anim-sound-frames x)
|
||||
(anim-sound-frames x)
|
||||
|
||||
(< x current-frame-index )
|
||||
(recur (inc x))
|
||||
|
||||
:else
|
||||
nil)))
|
||||
|
||||
(defn play-sound-if-necessary [screen entities target {:keys [previous-frame-index current-frame-index anim-sound-frames anim x y] :as e :or {anim-sound-frames {}}}]
|
||||
|
||||
|
||||
(if (and (not= previous-frame-index current-frame-index)
|
||||
(anim-sound-frames anim))
|
||||
(if-let [[snd vol-scale pitch] (get-in anim-sound-frames [anim current-frame-index])]
|
||||
(if-let [[snd vol-scale pitch] (get-necessary-sound (anim-sound-frames anim) previous-frame-index current-frame-index)]
|
||||
(let [snd (if (fn? snd)
|
||||
(snd entities)
|
||||
snd)
|
||||
|
||||
Reference in New Issue
Block a user