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

@@ -15,7 +15,7 @@
(defn close [entities]
(run! @(resolve 'advent.screens.scene/scene) :on-reactivate)
(screen! @(resolve 'advent.screens.scene/scene) :on-reactivate)
(-> entities
(assoc :shown? false)
(assoc :start-showing? false)))
@@ -90,7 +90,7 @@
current-cursor (get-in room-entities [:cursor :current])]
(if highlighted-item
(if (= :main current-cursor)
(run! @(resolve 'advent.screens.scene/scene) :on-chose-item :item highlighted-item)
(screen! @(resolve 'advent.screens.scene/scene) :on-chose-item :item highlighted-item)
(when-let [interaction-script ((or (:scripts highlighted-item) (constantly nil)) (:value current-cursor))]
(interaction-script room-entities)
(close entities)))

View File

@@ -31,7 +31,7 @@
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240)]
:entities {:wizard (actions/start-animation screen (assoc (animation->texture screen wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:entities {:wizard (actions/start-animation screen (assoc (animation->texture (doto screen) wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:left {:talk (utils/flip wizard-talk)
:stand (utils/flip wizard-stand)}
:right {:talk wizard-talk

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]]