screens can load their resources

This commit is contained in:
Bryce Covert
2017-05-27 17:11:16 -07:00
parent 5332683347
commit b863e1de12
9 changed files with 48 additions and 45 deletions

View File

@@ -280,7 +280,8 @@
(defn play-animation [entities target-id anim & {:keys [stop? continue? next]}]
(run-action entities
(begin [this screen entities]
(update-in entities [:room :entities target-id] #(start-animation screen % anim) ))
(update-in entities [:room :entities target-id] #(doto (start-animation screen % anim)
println) ))
(continue [this screen entities] entities)
@@ -677,7 +678,8 @@
(defn transition-background [entities new-background [x y] & {:keys [transition-music? between time face]}]
(let [transition-music? (if (nil? transition-music?) true transition-music?)
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]))
;; TODO FIX
new-music old-music
music-changed? (and transition-music? (not= old-music new-music))
time (/ (float (or time 1.0)) 2.0)]
(run-action entities
@@ -720,7 +722,7 @@
(let [ego (get-in entities [:room :entities :ego])
old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
entities (as-> entities e
(assoc-in e [:room] (get-in entities [:rooms new-background]))
(assoc-in e [:room] ((get-in entities [:rooms new-background]) screen))
(assoc-in e [:room :entities :ego] ego)
(assoc-in e [:current-sounds :value] [])
(if between (between screen e) e)