supporting going around at night.

This commit is contained in:
2014-12-27 17:20:06 -08:00
parent 329902dda8
commit 8d6f673625
3 changed files with 10 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -53,7 +53,8 @@
:ego "He's the mightiest knight in all of Remington."
:ego "If only I could be as strong as him one day."
))}}
:layers [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)]
:layers {:day [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)]
:night [(assoc (texture "outside-jail/background-dark.png") :x 0 :y 0 :baseline 0)]}
:entities {:fountain (assoc (animation->texture screen fountain)
:x 150 :y 126 :baseline 114
:anim fountain

View File

@@ -283,6 +283,12 @@
(defn stop-sound [snd]
(music! snd :stop))
(defn get-layers [entities]
(let [layers (get-in entities [:room :layers])]
(if (map? layers)
((get-in entities [:state :time]) layers)
layers)))
(defn make-music [r]
(doto (music r) (music! :set-looping true)))
@@ -371,8 +377,9 @@
[id ((:update-fn entity) screen entities entity)]
[id entity])))))
current-frame (get-in entities [:room :entities :ego :object])
layers (get-layers entities)
all-entities (concat (vals entities) (get-in entities [:room :layers]) (vals (get-in entities [:room :entities])))]
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
(when (and (not= current-frame (get-in entities [:room :entities :ego :last-frame]))
(or (= (get-in entities [:room :entities :ego :anim]) (get-in entities [:room :entities :ego :left :walk]))
(= (get-in entities [:room :entities :ego :anim]) (get-in entities [:room :entities :ego :right :walk])))