addded crappy night music.

This commit is contained in:
2014-12-28 17:14:17 -08:00
parent 3ef0a4e157
commit 972a284fac
8 changed files with 20 additions and 13 deletions

View File

@@ -457,9 +457,14 @@
(can-skip? [this screen entities]
false)))
(defn get-music [music time]
(if (keyword? music)
music
(time music)))
(defn transition-music
([entities new-music]
(transition-music entities (get-in @entities [:room :music]) new-music))
(transition-music entities (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time])) new-music))
([entities old-music new-music]
(let [current-volume (atom 1.0)]
(run-action entities
@@ -482,9 +487,10 @@
(can-skip? [this screen entities]
false)))))
(defn transition-background [entities new-background [x y]]
(let [old-music (get-in @entities [:room :music])
new-music (get-in @entities [:rooms new-background :music])
(let [old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
new-music (get-music (get-in @entities [:rooms new-background :music]) (get-in @entities [:state :time]))
music-changed? (not= old-music new-music)]
(run-action entities
(begin [this screen entities]
@@ -514,12 +520,12 @@
(run-action entities
(begin [this screen entities]
(let [ego (get-in entities [:room :entities :ego])
old-music (get-in entities [:room :music])
old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
entities (-> entities
(assoc-in [:room] (get-in entities [:rooms new-background]))
(assoc-in [:room :entities :ego] ego)
(assoc-in [:state :last-room] new-background))
new-music (get-in entities [:room :music])
new-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
apply-state (get-in entities [:room :apply-state])
entities (if apply-state
(apply-state entities)

View File

@@ -13,7 +13,7 @@
(assoc-in entities [:room :entities :peeling :opacity] 0))
(defn make [screen]
(rooms/make :music :town-2
(rooms/make :music {:day :town-2 :night :night}
:interactions
{:left-dir {:box [0 131 20 224]
:script (actions/get-script

View File

@@ -191,7 +191,7 @@
owl-stand (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [0 0 0 0 0 0 0 2])
owl-talk (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [1 0 1 0 1 0 0 0 2 0])
owl-puke (utils/make-anim "cat-tree/owl.png" [19 28] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])]
(rooms/make :music :town-2
(rooms/make :music {:day :town-2 :night :night}
:interactions
{:down-dir {:box [150 0 270 20]
:script (actions/get-script entities

View File

@@ -172,7 +172,7 @@
trophy (utils/make-anim "inside-castle/trophy.png" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1]))
pull-sword-anim (utils/make-anim "inside-castle/pull-sword.png" [95 190] 0.10 (flatten [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 3 2 3 2 3 3 2 3 2 2 3 3 2 3 2 3 2 3 2 3 2 3 2 2 3 3 3 2 3 2 3 3 2 3 2 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ]))
monocle (utils/make-anim "inside-castle/monocle.png" [7 7] 0.05 (flatten [(repeat 70 0) 1 2 3 3 3 2 1]))]
(rooms/make :music :town-1
(rooms/make :music {:day :town-1 :night :night}
:interactions
{:right-door {:box [286 140 306 160]
:cursor :right

View File

@@ -139,7 +139,7 @@
steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]]
(aget steer-sheet 0 i)))
flies-stand (utils/make-anim "outside-castle/flies.png" [15 15] 0.075 [0 1 2 1])]
(rooms/make :music :town-2
(rooms/make :music {:day :town-2 :night :night}
:interactions
{:right-dir {:box [300 40 320 140]
:script (actions/get-script

View File

@@ -166,7 +166,7 @@
(aget sheep-walk-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4))]
(rooms/make :music :town-2
(rooms/make :music {:day :town-2 :night :night}
:interactions
{:door {:box [258 100 281 160]
:script

View File

@@ -43,7 +43,7 @@
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i)))
guard-sleep (utils/make-anim "outside-jail/guard-sleep.png" [43 67] 0.1 (range 4))]
(rooms/make :music :town-2
(rooms/make :music {:day :town-1 :night :night}
:interactions {:down-dir {:box [30 0 227 20]
:script (actions/get-script entities
(actions/walk-to entities :ego [159 5])

View File

@@ -337,7 +337,8 @@
:town-2 (make-music "town-music-2.ogg")
:inside-fangald (make-music "inside-fangald.ogg")
:fight (make-music "megaboss.mp3")
:pull-sword (make-music "pull-sword.ogg")}
:pull-sword (make-music "pull-sword.ogg")
:night (make-music "night.ogg")}
:state (get-state)
:actions {:object nil
:channel (chan)
@@ -356,7 +357,7 @@
:mouse-in? (zone/box 278 0 320 42))
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 0)}]
(play-sound (get-in entities [:musics (get-in entities [:room :music])]))
(play-sound (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))]))
(doseq [[k [start time fn]] (get-in entities [:room :timers])]
(add-timer! screen k start time))