multiple step sounds

This commit is contained in:
Bryce Covert
2015-10-08 09:59:09 -07:00
parent e3c80bf16e
commit 2ff70ff209
11 changed files with 20 additions and 9 deletions

View File

@@ -14,7 +14,6 @@ IOS
+ update-override slow on IOS + update-override slow on IOS
AUDIO AUDIO
+ Walking
+ blink + blink
+ scratch + scratch
+ peddler scratch + peddler scratch

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -518,6 +518,13 @@ void main()
crawl-stand (utils/make-anim "ego/crawl.png" [39 25] 0.2 [0]) crawl-stand (utils/make-anim "ego/crawl.png" [39 25] 0.2 [0])
crawl-hide (utils/make-anim "ego/crawl.png" [39 25] 0.1 (flatten [(repeat 10 3) (range 4 7) (repeat 50 6) (reverse (range 4 7) ) (repeat 20 3)])) crawl-hide (utils/make-anim "ego/crawl.png" [39 25] 0.1 (flatten [(repeat 10 3) (range 4 7) (repeat 50 6) (reverse (range 4 7) ) (repeat 20 3)]))
standup (utils/make-anim "ego/standup.png" [45 55] 0.2 (range 5)) standup (utils/make-anim "ego/standup.png" [45 55] 0.2 (range 5))
choose-step-sound (fn [entities]
(if (#{:inside-house :inside-stash :inside-cafeteria :inside-antique :inside-jail}
(get-in entities [:state :last-room]))
:blink
(rand-nth [:step-sound-1 :step-sound-2 :step-sound-3 :step-sound-4])))
ego {:right {:walk walk-right ego {:right {:walk walk-right
:stand stand-anim :stand stand-anim
@@ -625,6 +632,8 @@ void main()
:milk-sound (utils/load-sound "outsidehouse/milk.ogg") :milk-sound (utils/load-sound "outsidehouse/milk.ogg")
:step-sound-1 (utils/load-sound "ego/step-1.ogg") :step-sound-1 (utils/load-sound "ego/step-1.ogg")
:step-sound-2 (utils/load-sound "ego/step-2.ogg") :step-sound-2 (utils/load-sound "ego/step-2.ogg")
:step-sound-3 (utils/load-sound "ego/step-3.ogg")
:step-sound-4 (utils/load-sound "ego/step-4.ogg")
:sigh-sound (utils/load-sound "ego/sigh.ogg") :sigh-sound (utils/load-sound "ego/sigh.ogg")
:breakglass-sound (utils/load-sound "ego/breakglass.ogg") :breakglass-sound (utils/load-sound "ego/breakglass.ogg")
:idea-sound (utils/load-sound "ego/idea.ogg") :idea-sound (utils/load-sound "ego/idea.ogg")
@@ -643,10 +652,10 @@ void main()
:x (first start-pos) :y (last start-pos) :x (first start-pos) :y (last start-pos)
:id "ego"} :id "ego"}
ego (assoc ego :anim-sound-frames {(get-in ego [:left :walk]) {2 [:step-sound-1 1.0] ego (assoc ego :anim-sound-frames {(get-in ego [:left :walk]) {2 [choose-step-sound 0.6]
6 [:step-sound-2 0.8]} 6 [choose-step-sound 0.6]}
(get-in ego [:right :walk]) {2 [:step-sound-1 1.0] (get-in ego [:right :walk]) {2 [choose-step-sound 0.6]
6 [:step-sound-2 0.8]} 6 [choose-step-sound 0.6]}
(get-in ego [:left :talk] ) {2 [:blink 0.15]} (get-in ego [:left :talk] ) {2 [:blink 0.15]}
(get-in ego [:right :talk] ) {2 [:blink 0.15]} (get-in ego [:right :talk] ) {2 [:blink 0.15]}
@@ -803,10 +812,13 @@ void main()
(if (and (not= previous-frame-index current-frame-index) (if (and (not= previous-frame-index current-frame-index)
((set (keys anim-sound-frames)) anim)) ((set (keys anim-sound-frames)) anim))
(if-let [[snd vol-scale] (get-in anim-sound-frames [anim current-frame-index])] (if-let [[snd vol-scale] (get-in anim-sound-frames [anim current-frame-index])]
(utils/play-sound! screen entities (let [snd (if (fn? snd)
(or (snd e) (snd (:sounds entities))) (snd entities)
(utils/sourced-volume-fn target vol-scale [x y]) snd)]
(utils/get-sound-pan x)) (utils/play-sound! screen entities
(or (snd e) (snd (:sounds entities)))
(utils/sourced-volume-fn target vol-scale [x y])
(utils/get-sound-pan x)))
entities) entities)
entities)) entities))