added concept of different background musics.

This commit is contained in:
2014-11-03 22:51:08 -08:00
parent 0390c2bfa5
commit 57a84f5101
8 changed files with 30 additions and 10 deletions

View File

@@ -153,13 +153,15 @@
(defn animate [entity screen]
(merge entity (animation->texture (update-in screen [:total-time] #(- % (:anim-start entity)))
(:anim entity))))
(defn play-sound [snd]
(sound! snd :loop 0.3))
(defscreen scene
:on-show
(fn [screen entities]
(update! screen :renderer (stage) :camera (orthographic))
(let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
music (sound "town-music.mp3")
_ (sound! music :loop 0.30)
(let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
rooms {:inside-house (rooms.inside-house/make screen)
:outside-house (rooms.outside-house/make screen)
:behind-house (rooms.behind-house/make screen)
@@ -167,6 +169,10 @@
:inside-castle (rooms.inside-castle/make screen)
:outside-castle (rooms.outside-castle/make screen)}]
{:rooms rooms
:musics {:object nil
:town-1 (sound "town-music.mp3")
:town-2 (doto (sound "town-music-2.mp3") play-sound)
:inside-fangald (sound "inside-fangald.mp3")}
:state {:object nil
:active? true
:inventory []}