good sounds.

This commit is contained in:
2015-02-21 11:11:43 -08:00
parent 201a428d7d
commit ed0ddefa3f
7 changed files with 36 additions and 22 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -323,7 +323,6 @@
:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
`:talk-color (color 1.0 0.3 0.2 1.0)
:script (actions/get-script entities (do-game-player-dialogue entities))
:blink (sound "blink-other.ogg")
:scripts #(condp = %
:wool (actions/get-script entities
(walk-to-player entities)

View File

@@ -261,7 +261,16 @@
:fall-asleep warden-fall-asleep
:anim warden-stand
:anim-start 0
:inhale (sound "inside-jail/inhale.ogg")
:exhale (sound "inside-jail/exhale.ogg")
:talk-color (color 0.9 0.3 0.9 1.0)
:anim-sound-frames {warden-stand {31 [:blink 0.15]
51 [:blink 0.15]}
warden-talk {10 [:blink 0.15]}
warden-fall-asleep {7 [:blink 0.15]
18 [:blink 0.15]}
warden-sleep {0 [:inhale 1.0]
2 [:exhale 1.0]}}
:script (actions/get-script entities
(cond
(actions/has-item? entities :key) (actions/talk entities :ego "Shh! It's best not to wake him now.")

View File

@@ -307,21 +307,21 @@
(get-in ego [:right :walk]) {2 [:step-sound-1 1.0]
6 [:step-sound-2 0.8]}
(get-in ego [:left :talk] ) {2 [:blink 0.2]}
(get-in ego [:right :talk] ) {2 [:blink 0.2]}
(get-in ego [:left :talk] ) {2 [:blink 0.15]}
(get-in ego [:right :talk] ) {2 [:blink 0.15]}
(get-in ego [:left :stand]) {11 [:blink 0.20]
44 [:blink 0.20]
77 [:blink 0.20]
110 [:blink 0.20]
143 [:blink 0.20]
176 [:blink 0.20]}
(get-in ego [:right :stand]) {11 [:blink 0.20]
44 [:blink 0.20]
77 [:blink 0.20]
110 [:blink 0.20]
143 [:blink 0.20]
176 [:blink 0.20]}}
(get-in ego [:left :stand]) {11 [:blink 0.15]
44 [:blink 0.15]
77 [:blink 0.15]
110 [:blink 0.15]
143 [:blink 0.15]
176 [:blink 0.15]}
(get-in ego [:right :stand]) {11 [:blink 0.15]
44 [:blink 0.15]
77 [:blink 0.15]
110 [:blink 0.15]
143 [:blink 0.15]
176 [:blink 0.15]}}
:anim-merges {(get-in ego [:right :shock]) {:origin-x 15}
:default {:origin-x 9}})]
(actions/start-animation screen
@@ -404,23 +404,26 @@
entities))
(defn play-key-sounds [entities]
(doseq [[target {:keys [previous-frame-index current-frame-index anim-sound-frames anim x y] :as e}] entities]
(doseq [[target {:keys [previous-frame-index current-frame-index anim-sound-frames anim x y] :as e}] (get-in entities [:room :entities])]
(when (and (not= previous-frame-index current-frame-index)
((set (keys anim-sound-frames)) anim))
(when-let [[snd vol-scale] (get-in anim-sound-frames [anim current-frame-index])]
(println "play")
(let [vol (if (= target :ego)
(* (/ (get-in entities [:ego :scale-x]) 1.5) 0.75)
(* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(max 0.0
(- 1.0 (/ (utils/dist x y
(get-in entities [:ego :x])
(get-in entities [:ego :y])
(get-in entities [:room :entities :ego :x])
(get-in entities [:room :entities :ego :y])
:y-sign 2.0
:x-sign (/ 1.0 (get-in entities [:ego :scale-x])))
:x-sign (/ 1.0 (get-in entities [:room :entities :ego :scale-x])))
175.0))))
vol (* vol vol-scale)
vol (max vol 0.005)]
(sound! (snd e) :play vol))))))
(println vol snd)
(sound! (or (snd e)
(snd (:sounds entities))) :play vol))))))
(defscreen scene
@@ -461,6 +464,9 @@
:pull-sword (utils/make-music "pull-sword.ogg")
:night (utils/make-music "night.ogg")}
:state (get-state)
:sounds {:blink (sound "blink-other.ogg")
:object nil}
:fade (assoc (texture "black.png")
:scale-x 20
:scale-y 20
@@ -547,7 +553,7 @@
(when (= (get-in entities [:fade :opacity])
0.0)
(play-key-sounds (get-in entities [:room :entities])))
(play-key-sounds entities))
(doseq [m (vals (get-in entities [:musics]))]
(when m
(music! m :set-volume (get-in entities [:volume :value]))))