music and latest version.

This commit is contained in:
2014-11-04 12:50:48 -08:00
parent f2bcae0d45
commit 9a331cba07
4 changed files with 45 additions and 41 deletions

View File

@@ -40,7 +40,7 @@
(get-in entities [:room :interactions]))))
(defn open-inventory [screen entities]
(run! inventory-screen :show-screen :items (get-in entities [:state :inventory]))
(screen! inventory-screen :show-screen :items (get-in entities [:state :inventory]))
(assoc-in entities [:state :active?] false))
@@ -155,40 +155,44 @@
(:anim entity))))
(defn play-sound [snd]
(sound! snd :loop 0.3))
(music! snd :play))
(defn make-music [r]
(doto (music r) (music! :set-looping true)))
(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)
rooms {:inside-house (rooms.inside-house/make screen)
:outside-house (rooms.outside-house/make screen)
:behind-house (rooms.behind-house/make screen)
:cat-tree (rooms.cat-tree/make screen)
: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 []}
:actions {:object nil
:channel (chan)
:current nil
:started? false}
:cursor {:id "cursor"
:current :main
:last :main
:override nil}
:room (assoc-in (:outside-house rooms)
[:entities :ego] (get-ego screen))
:inventory (assoc (texture "inventory.png") :x 278 :y 0 :baseline 9000
:mouse-in? (zone/box 278 0 320 42))
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 0)}))
(let [screen (assoc screen :total-time 0)]
(update! screen :renderer (stage) :camera (orthographic))
(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)
:cat-tree (rooms.cat-tree/make screen)
:inside-castle (rooms.inside-castle/make screen)
:outside-castle (rooms.outside-castle/make screen)}]
{:rooms rooms
:musics {:object nil
:town-1 (make-music "town-music-1.ogg")
:town-2 (doto (make-music "town-music-2.ogg") play-sound)
:inside-fangald (make-music "inside-fangald.ogg")}
:state {:object nil
:active? true
:inventory []}
:actions {:object nil
:channel (chan)
:current nil
:started? false}
:cursor {:id "cursor"
:current :main
:last :main
:override nil}
:room (assoc-in (:outside-house rooms)
[:entities :ego] (get-ego screen))
:inventory (assoc (texture "inventory.png") :x 278 :y 0 :baseline 9000
:mouse-in? (zone/box 278 0 320 42))
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 0)})))
:on-render
(fn [screen [entities]]