saving and loading starting room.
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
entities))))
|
||||
|
||||
|
||||
(defn get-ego [screen]
|
||||
(defn get-ego [screen start-pos]
|
||||
(let [player-sheet (texture! (texture "player.png") :split 18 36)
|
||||
talk-sheet (texture! (texture "ego/talk.png") :split 18 36)
|
||||
stand-sheet (texture! (texture "ego/stand.png") :split 18 36)
|
||||
@@ -135,7 +135,7 @@
|
||||
[:fire 1] (utils/flip fire-1-anim)
|
||||
[:fire 2] (utils/flip fire-2-anim)
|
||||
[:fire 3] (utils/flip fire-3-anim)}
|
||||
:baseline 95
|
||||
:baseline (- 240 (last start-pos))
|
||||
:facing :right
|
||||
:origin-x 9
|
||||
:origin-y 0
|
||||
@@ -166,7 +166,7 @@
|
||||
:ego "'Not more than that do drink,'"
|
||||
:ego "'Or you'll push your body to the brink.'"))
|
||||
nil))
|
||||
:x 150 :y 95
|
||||
:x (first start-pos) :y (last start-pos)
|
||||
:id "ego"}]
|
||||
(actions/start-animation screen
|
||||
(merge (animation->texture screen (:stand (:right ego))) ego)
|
||||
@@ -203,6 +203,7 @@
|
||||
(music! snd :play))
|
||||
|
||||
(defn stop-sound [snd]
|
||||
(println "here")
|
||||
(music! snd :stop))
|
||||
|
||||
(defn make-music [r]
|
||||
@@ -213,6 +214,7 @@
|
||||
(utils/load)
|
||||
{:object nil
|
||||
:active? true
|
||||
:last-room :outside-house
|
||||
:inventory []
|
||||
:clues #{}
|
||||
:mints-eaten 0}))
|
||||
@@ -246,12 +248,15 @@
|
||||
:last :main
|
||||
:override nil}
|
||||
:all-items (assoc items/items :object nil)
|
||||
:room (assoc-in (:outside-house rooms)
|
||||
[:entities :ego] (get-ego screen))
|
||||
:room (as-> (get rooms (:last-room (get-state))) room
|
||||
(assoc-in room [:entities :ego] (get-ego screen (:start-pos room))))
|
||||
: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)}]
|
||||
((get-in entities [:room :apply-state]) entities))))
|
||||
|
||||
(if-let [apply-state (get-in entities [:room :apply-state])]
|
||||
(apply-state entities)
|
||||
entities))))
|
||||
|
||||
:on-render
|
||||
(fn [screen [entities]]
|
||||
@@ -272,12 +277,12 @@
|
||||
:on-resize (fn [screen entities]
|
||||
(size! screen 320 240))
|
||||
|
||||
:on-hide (fn [screen entities]
|
||||
(doall (->> (get-in entities [:room :entities :musics])
|
||||
vals
|
||||
(map identity)
|
||||
(map stop-sound)
|
||||
)))
|
||||
:on-hide (fn [screen [entities]]
|
||||
(println (keys entities))
|
||||
(doseq [snd (->> (doto (get-in entities [:musics]) println)
|
||||
vals
|
||||
(filter identity))]
|
||||
(stop-sound snd)))
|
||||
|
||||
:on-mouse-moved
|
||||
(fn [screen [entities]]
|
||||
|
||||
Reference in New Issue
Block a user