first attempt at an intro screen.

This commit is contained in:
2015-02-07 11:24:36 -08:00
parent 41e75513f5
commit e7b2e13f4a
6 changed files with 86 additions and 19 deletions

View File

@@ -321,11 +321,6 @@
(merge entity (animation->texture (update-in screen [:total-time] #(- % (:anim-start entity)))
(:anim entity))))
(defn play-sound [snd]
(music! snd :play))
(defn stop-sound [snd]
(music! snd :stop))
(defn get-layers [entities]
(let [layers (get-in entities [:room :layers])]
@@ -333,9 +328,6 @@
((get-in entities [:state :time]) layers)
layers)))
(defn make-music [r]
(doto (music r) (music! :set-looping true)))
(defn get-state []
(if (.exists (io/file "save.edn"))
(utils/load)
@@ -375,13 +367,13 @@
:outside-castle (rooms.outside-castle/make screen)}
entities {:rooms rooms
:musics {:object nil
:inside-antique (make-music "inside-antique.ogg")
:town-1 (make-music "town-music-1.ogg")
: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")
:night (make-music "night.ogg")}
:inside-antique (utils/make-music "inside-antique.ogg")
:town-1 (utils/make-music "town-music-1.ogg")
:town-2 (utils/make-music "town-music-2.ogg")
:inside-fangald (utils/make-music "inside-fangald.ogg")
:fight (utils/make-music "megaboss.mp3")
:pull-sword (utils/make-music "pull-sword.ogg")
:night (utils/make-music "night.ogg")}
:state (get-state)
:actions {:object nil
:channel (chan)
@@ -400,7 +392,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 (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))]))
(utils/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))
@@ -451,7 +443,7 @@
(doseq [snd (->> (get-in entities [:musics])
vals
(filter identity))]
(stop-sound snd)))
(utils/stop-sound snd)))
:on-mouse-moved
(fn [screen [entities]]