it all works, rather smoothly too.
This commit is contained in:
@@ -698,6 +698,7 @@
|
||||
(>= (get-in entities [:fade :opacity]) 1.0))
|
||||
|
||||
(terminate [this screen entities]
|
||||
(utils/release-resources screen :room)
|
||||
(let [entities (stop screen (if-let [next-time (get-in entities [:state :next-time])]
|
||||
(-> entities
|
||||
(assoc-in [:state :time] next-time)
|
||||
|
||||
@@ -28,151 +28,148 @@
|
||||
(actions/update-state entities
|
||||
(fn [state] (assoc state :safe-listen-count (inc (:safe-listen-count state 0))))))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screet atlas] (utils/acquire-atlas screen "packed/behindhouse.atlas")
|
||||
[screet global-atlas] (utils/acquire-atlas screen "packed/global.atlas")]
|
||||
(defn make [screen atlas global-atlas]
|
||||
(rooms/make :music {:day :town-2 :night :night}
|
||||
:name "Behind house"
|
||||
:interactions
|
||||
{:left-dir-1 (make-left-dir [0 48 20 240])
|
||||
:left-dir-2 (make-left-dir [0 160 148 217])
|
||||
:left-dir-3 (make-left-dir [130 120 154 160])
|
||||
|
||||
|
||||
(rooms/make :music {:day :town-2 :night :night}
|
||||
:name "Behind house"
|
||||
:interactions
|
||||
{:left-dir-1 (make-left-dir [0 48 20 240])
|
||||
:left-dir-2 (make-left-dir [0 160 148 217])
|
||||
:left-dir-3 (make-left-dir [130 120 154 160])
|
||||
|
||||
#_:crack #_{:box [68 100 73 114]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
)}
|
||||
:mushrooms {:box [247 59 269 76]
|
||||
:label "Mushrooms"
|
||||
:cursor :hand
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(if (actions/has-obtained? entities :mushrooms)
|
||||
(actions/talk entities :ego "I've already got a junk ton of mushrooms.")
|
||||
(do
|
||||
(actions/walk-to entities :ego [242 75])
|
||||
(actions/play-animation entities :ego :squat)
|
||||
(actions/give entities :mushrooms)
|
||||
(actions/talk entities :ego "Perfectly ripe mushrooms!"))))}
|
||||
:window {:box [109 100 130 153]
|
||||
:label "Window"
|
||||
:cursor :look
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(actions/walk-to entities :ego [128 100] :face :left)
|
||||
(cond
|
||||
(= :night (get-in @entities [:state :time]))
|
||||
(actions/do-dialogue entities :ego "The house is dark and empty.")
|
||||
|
||||
#_:crack #_{:box [68 100 73 114]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
)}
|
||||
:mushrooms {:box [247 59 269 76]
|
||||
:label "Mushrooms"
|
||||
:cursor :hand
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(if (actions/has-obtained? entities :mushrooms)
|
||||
(actions/talk entities :ego "I've already got a junk ton of mushrooms.")
|
||||
(do
|
||||
(actions/walk-to entities :ego [242 75])
|
||||
(actions/play-animation entities :ego :squat)
|
||||
(actions/give entities :mushrooms)
|
||||
(actions/talk entities :ego "Perfectly ripe mushrooms!"))))}
|
||||
:window {:box [109 100 130 153]
|
||||
:label "Window"
|
||||
:cursor :look
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(actions/walk-to entities :ego [128 100] :face :left)
|
||||
(cond
|
||||
(= :night (get-in @entities [:state :time]))
|
||||
(actions/do-dialogue entities :ego "The house is dark and empty.")
|
||||
(actions/has-obtained? entities :tune)
|
||||
(actions/do-dialogue entities
|
||||
:ego "Gandarf's just working on one of his spells.")
|
||||
|
||||
(actions/has-obtained? entities :tune)
|
||||
(get-in @entities [:state :peeked-in-window?])
|
||||
(actions/do-dialogue entities
|
||||
:ego "Gandarf is moving around in the corner of the room."
|
||||
:ego "I think he's opening his MagiSafe!"
|
||||
:ego "I'll need a better spying angle if I hope to crack the safe.")
|
||||
|
||||
:else
|
||||
(do
|
||||
(actions/do-dialogue entities
|
||||
:ego "Gandarf's just working on one of his spells.")
|
||||
|
||||
(get-in @entities [:state :peeked-in-window?])
|
||||
(actions/do-dialogue entities
|
||||
:ego "Gandarf is moving around in the corner of the room."
|
||||
:ego "I think he's opening his MagiSafe!"
|
||||
:ego "I'll need a better spying angle if I hope to crack the safe.")
|
||||
|
||||
:else
|
||||
(do
|
||||
(actions/do-dialogue entities
|
||||
:ego "I can see Gandarf moving around in the corner of the room."
|
||||
:ego "It's hard to make out from this angle.")
|
||||
(actions/update-state entities #(assoc % :peeked-in-window? true)))))}}
|
||||
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
:ego "I can see Gandarf moving around in the corner of the room."
|
||||
:ego "It's hard to make out from this angle.")
|
||||
(actions/update-state entities #(assoc % :peeked-in-window? true)))))}}
|
||||
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/atlas->texture atlas "brush") :x 0 :y 0 :baseline 240)
|
||||
(assoc (utils/atlas->texture atlas "fgleft") :x -10 :y 0 :baseline 240 :parallax 1.5)
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
|
||||
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/atlas->texture atlas "brush") :x 0 :y 0 :baseline 240)
|
||||
(assoc (utils/atlas->texture atlas "fgleft") :x -10 :y 0 :baseline 240 :parallax 1.5)
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
|
||||
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/atlas->texture atlas "brush") :x 0 :y 0 :baseline 240)
|
||||
(assoc (utils/atlas->texture atlas "fgleft") :x -10 :y 0 :baseline 240 :parallax 1.5)
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
|
||||
:entities {:stick (assoc (utils/atlas->texture atlas "stick")
|
||||
:x 26 :y 80 :baseline 160
|
||||
:label "Stick"
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
|
||||
:entities {:stick (assoc (utils/atlas->texture atlas "stick")
|
||||
:x 26 :y 80 :baseline 160
|
||||
:label "Stick"
|
||||
:cursor :hand
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [50 80])
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/remove-entity entities :stick)
|
||||
(actions/give entities :stick)
|
||||
(actions/talk entities :ego "This stick might be useful.")))
|
||||
|
||||
:peeling (assoc (utils/atlas->texture atlas "house-cover")
|
||||
:x 60 :y 92 :baseline 148
|
||||
:label "Crumbly wall"
|
||||
:cursor :hand
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [50 80])
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/remove-entity entities :stick)
|
||||
(actions/give entities :stick)
|
||||
(actions/talk entities :ego "This stick might be useful.")))
|
||||
|
||||
:peeling (assoc (utils/atlas->texture atlas "house-cover")
|
||||
:x 60 :y 92 :baseline 148
|
||||
:label "Crumbly wall"
|
||||
:cursor :hand
|
||||
:script (actions/get-script entities
|
||||
(cond (= :night (get-in @entities [:state :time]))
|
||||
(actions/talk entities :ego "The house is empty right now.")
|
||||
(cond (= :night (get-in @entities [:state :time]))
|
||||
(actions/talk entities :ego "The house is empty right now.")
|
||||
|
||||
(and (get-in @entities [:state :opened-crack?])
|
||||
(= 0 (get-in @entities [:state :safe-listen-count] 0)))
|
||||
(and (get-in @entities [:state :opened-crack?])
|
||||
(= 0 (get-in @entities [:state :safe-listen-count] 0)))
|
||||
|
||||
(do (actions/walk-to entities :ego [70 80])
|
||||
(actions/play-animation entities :ego :start-squat :stop? false)
|
||||
(actions/talk entities :ego "I can see Gandarf the wizard inside." :animate? false :stop? false)
|
||||
(actions/talk entities :ego "It looks like he's opening his MagiSafe." :animate? false :stop? false)
|
||||
(actions/play-safe entities false)
|
||||
(actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false)
|
||||
(actions/play-animation entities :ego :end-squat)
|
||||
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")
|
||||
(steam/set-achievement "SAFE_AND_SOUND")
|
||||
(increment-safe-listens entities))
|
||||
(do (actions/walk-to entities :ego [70 80])
|
||||
(actions/play-animation entities :ego :start-squat :stop? false)
|
||||
(actions/talk entities :ego "I can see Gandarf the wizard inside." :animate? false :stop? false)
|
||||
(actions/talk entities :ego "It looks like he's opening his MagiSafe." :animate? false :stop? false)
|
||||
(actions/play-safe entities false)
|
||||
(actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false)
|
||||
(actions/play-animation entities :ego :end-squat)
|
||||
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")
|
||||
(steam/set-achievement "SAFE_AND_SOUND")
|
||||
(increment-safe-listens entities))
|
||||
|
||||
(and (get-in @entities [:state :opened-crack?])
|
||||
(= 1 (get-in @entities [:state :safe-listen-count] 0)))
|
||||
(and (get-in @entities [:state :opened-crack?])
|
||||
(= 1 (get-in @entities [:state :safe-listen-count] 0)))
|
||||
|
||||
(do (actions/walk-to entities :ego [70 80])
|
||||
(actions/talk entities :ego "I'll give it another listen.")
|
||||
(actions/play-animation entities :ego :start-squat :stop? false)
|
||||
(actions/talk entities :ego "It looks like Gandarf's opening his MagiSafe." :animate? false :stop? false)
|
||||
(actions/play-safe entities false)
|
||||
(actions/play-animation entities :ego :end-squat)
|
||||
(actions/talk entities :ego "Ugh! Now I've got it stuck in my head!")
|
||||
(increment-safe-listens entities)
|
||||
(actions/give entities :tune))
|
||||
(do (actions/walk-to entities :ego [70 80])
|
||||
(actions/talk entities :ego "I'll give it another listen.")
|
||||
(actions/play-animation entities :ego :start-squat :stop? false)
|
||||
(actions/talk entities :ego "It looks like Gandarf's opening his MagiSafe." :animate? false :stop? false)
|
||||
(actions/play-safe entities false)
|
||||
(actions/play-animation entities :ego :end-squat)
|
||||
(actions/talk entities :ego "Ugh! Now I've got it stuck in my head!")
|
||||
(increment-safe-listens entities)
|
||||
(actions/give entities :tune))
|
||||
|
||||
(get-in @entities [:state :opened-crack?])
|
||||
(actions/talk entities :ego "I've got the tune stuck in my head already.")
|
||||
(get-in @entities [:state :opened-crack?])
|
||||
(actions/talk entities :ego "I've got the tune stuck in my head already.")
|
||||
|
||||
:else
|
||||
(do (actions/walk-to entities :ego [80 80] :face :left)
|
||||
(actions/talk entities :ego "It looks like the wall is crumbling here.")
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/update-entity entities :peeling #(assoc % :opacity 0))
|
||||
(actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))
|
||||
:scripts {:stick (actions/get-script entities
|
||||
|
||||
(if (get-in @entities [:state :opened-crack?])
|
||||
(actions/talk entities :ego "I could shove the stick in that hole, but why?")
|
||||
(actions/do-dialogue entities
|
||||
:ego "It looks like that wall is crumbling."
|
||||
:ego "I can probably scratch it off with my hand.")))
|
||||
:sword (actions/get-script entities
|
||||
|
||||
:else
|
||||
(do (actions/walk-to entities :ego [80 80] :face :left)
|
||||
(actions/talk entities :ego "It looks like the wall is crumbling here.")
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/update-entity entities :peeling #(assoc % :opacity 0))
|
||||
(actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))
|
||||
:scripts {:stick (actions/get-script entities
|
||||
|
||||
(if (get-in @entities [:state :opened-crack?])
|
||||
(actions/talk entities :ego "I could shove the stick in that hole, but why?")
|
||||
(actions/do-dialogue entities
|
||||
:ego "I should be careful with this sword."
|
||||
:ego "It's sharp!"))})
|
||||
:bird (utils/make-bird screen global-atlas [[50 235] [80 220] [100 239] [180 235] [85 225]])
|
||||
:outside-particles (common/make-outside-particles)}
|
||||
:collision "behindhouse/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
||||
:apply-state (fn [_ entities]
|
||||
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
|
||||
(as-> entities entities
|
||||
(if (get-in entities [:state :opened-crack?])
|
||||
(assoc-in entities [:room :entities :peeling :opacity] 0)
|
||||
entities)
|
||||
(if (actions/has-obtained? entities :stick)
|
||||
(update-in entities [:room :entities] #(dissoc % :stick))
|
||||
entities)
|
||||
(if (= :night (get-in entities [:state :time]))
|
||||
(make-night entities)
|
||||
entities)))
|
||||
:start-pos [172 122])))
|
||||
:ego "It looks like that wall is crumbling."
|
||||
:ego "I can probably scratch it off with my hand.")))
|
||||
:sword (actions/get-script entities
|
||||
|
||||
(actions/do-dialogue entities
|
||||
:ego "I should be careful with this sword."
|
||||
:ego "It's sharp!"))})
|
||||
:bird (utils/make-bird screen global-atlas [[50 235] [80 220] [100 239] [180 235] [85 225]])
|
||||
:outside-particles (common/make-outside-particles)}
|
||||
:collision "behindhouse/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
||||
:apply-state (fn [_ entities]
|
||||
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
|
||||
(as-> entities entities
|
||||
(if (get-in entities [:state :opened-crack?])
|
||||
(assoc-in entities [:room :entities :peeling :opacity] 0)
|
||||
entities)
|
||||
(if (actions/has-obtained? entities :stick)
|
||||
(update-in entities [:room :entities] #(dissoc % :stick))
|
||||
entities)
|
||||
(if (= :night (get-in entities [:state :time]))
|
||||
(make-night entities)
|
||||
entities)))
|
||||
:start-pos [172 122]))
|
||||
|
||||
@@ -197,10 +197,8 @@
|
||||
:scripts {:charcoal (actions/get-script entities
|
||||
(sign-note entities))}})
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/castle-gate.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
throw-walkie (utils/make-anim-seq atlas "throw-walkie" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [throw-walkie (utils/make-anim-seq atlas "throw-walkie" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
|
||||
walkie-visible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 8)])
|
||||
walkie-invisible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 0)])]
|
||||
(rooms/make :music {:day :town-2 :night :night}
|
||||
|
||||
@@ -242,9 +242,8 @@
|
||||
(actions/walk-straight-to entities :ego [140 85] :face :right :update-baseline? false)
|
||||
(actions/add-entity entities :blank (get-in @entities [:room :blank])))}})
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/cat-tree.atlas")
|
||||
cat-stand-sheet (texture! (utils/atlas->texture atlas "cat-stand") :split 22 10)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [cat-stand-sheet (texture! (utils/atlas->texture atlas "cat-stand") :split 22 10)
|
||||
cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])]
|
||||
(aget cat-stand-sheet 0 i)))
|
||||
cat-walk (animation 0.2 [(utils/atlas->texture atlas "pounce")])
|
||||
|
||||
@@ -365,9 +365,8 @@
|
||||
:fairy-godfather "Imagine the sweet smell of victory once you've mopped up some spilled milk."
|
||||
:fairy-godfather "Or the smell of soap in the bathroom, where you'll spend your time making the tile and porcelain shine."))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/dream.atlas")
|
||||
fairy-godfather-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [fairy-godfather-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
|
||||
fairy-godfather-talk-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [5 6 7 8 7 6])
|
||||
fairy-godfather-magic-anim (utils/make-anim atlas "fairy-godfather-magic" [100 77] 0.15 [0 1 2 3 4 4 4 4 3 2 1 0])]
|
||||
(rooms/make :music {:intro :wind :day :dream}
|
||||
|
||||
@@ -17,11 +17,8 @@
|
||||
[play-clj.g2d :refer :all])
|
||||
(:import [com.badlogic.gdx.graphics Color]))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/ending-castle.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
|
||||
peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
|
||||
peddler-stand (utils/flip (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 8 0) 6 (repeat 5 0) 4 5 4 5 4 5])]
|
||||
(aget peddler-sheet 0 i))))
|
||||
warden-stand (utils/make-anim atlas "warden-2" [21 41] 0.21 (flatten [(repeat 7 0) 1]))
|
||||
|
||||
@@ -56,9 +56,8 @@
|
||||
(actions/get-script entities
|
||||
(actions/talk entities who msg)))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/held.atlas")
|
||||
bloodclot-talk (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [bloodclot-talk (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
|
||||
bloodclot-stand (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
|
||||
(rooms/make :music :fight
|
||||
:name "Held"
|
||||
|
||||
@@ -196,9 +196,8 @@
|
||||
(assoc-in [:room :entities :darken :opacity] 0.4)
|
||||
(assoc-in [:room :entities :glow :opacity] 0.0))))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-antique.atlas")
|
||||
shopkeep-sheet (texture! (utils/atlas->texture atlas "shopkeep-talk") :split 18 21)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [shopkeep-sheet (texture! (utils/atlas->texture atlas "shopkeep-talk") :split 18 21)
|
||||
shopkeep-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 1 (repeat 50 0) 1 0 1 0])]
|
||||
(aget shopkeep-sheet 0 i)))
|
||||
shopkeep-talk (animation 0.15 (for [i [0 2 0 2 0 3 1 0]]
|
||||
|
||||
@@ -171,13 +171,8 @@
|
||||
(defn pace [xs speed]
|
||||
(mapcat #(repeat (- 4 speed) %) xs))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-cafeteria.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
|
||||
|
||||
|
||||
ladder-guard-stand (animation 0.1 [(utils/atlas->texture atlas "ladder-guard-2")])
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [ladder-guard-stand (animation 0.1 [(utils/atlas->texture atlas "ladder-guard-2")])
|
||||
ladder-guard-talk (animation 0.1 [ (utils/atlas->texture atlas "ladder-guard-2")])
|
||||
warriors-stand (utils/make-anim atlas "knights-stand" [49 80] 0.6 (take 100 (repeatedly #(rand-int 10))))
|
||||
knight-a-stand (utils/make-anim atlas "knight-a" [70 85] 0.2 (flatten [(repeat 3 [(repeat 7 0) (repeat 7 1) (repeat 7 0) (repeat 7 2)]) [3 4 5 6 7 8 9]]))
|
||||
|
||||
@@ -360,11 +360,8 @@
|
||||
(do (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")
|
||||
nil)))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screet atlas] (utils/acquire-atlas screen "packed/inside-castle.atlas")
|
||||
[screet global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
|
||||
sign (utils/make-anim-seq atlas "sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1]))
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [sign (utils/make-anim-seq atlas "sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1]))
|
||||
game-player-talk-sheet (texture! (utils/atlas->texture atlas "game-player-talk") :split 40 44)
|
||||
game-player-talk-up (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]]
|
||||
(aget game-player-talk-sheet 0 i)))
|
||||
|
||||
@@ -131,10 +131,8 @@
|
||||
"Nevermind."
|
||||
{:run #(actions/do-dialogue entities :ego %)}]}))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-house.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
safe-lock (utils/make-anim atlas "safe-lock" [11 8] 0.1 (flatten [(repeat 20 0) 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 (range 3 20) 20 20 20 20 21 21 21 21 21 20 20 21 21 21 21 21 20 20 20 ]))
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [safe-lock (utils/make-anim atlas "safe-lock" [11 8] 0.1 (flatten [(repeat 20 0) 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 (range 3 20) 20 20 20 20 21 21 21 21 21 20 20 21 21 21 21 21 20 20 20 ]))
|
||||
candle (utils/make-anim atlas "candle" [34 32] 0.2 [1 0 1 2])
|
||||
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
|
||||
experiment-left (utils/flip (utils/make-anim-seq global-atlas "wizard/experiment" [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
|
||||
|
||||
@@ -216,9 +216,8 @@
|
||||
|
||||
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-jail.atlas")
|
||||
warden-sheet (texture! (utils/atlas->texture atlas "warden") :split 43 58)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [warden-sheet (texture! (utils/atlas->texture atlas "warden") :split 43 58)
|
||||
warden-talk (animation 0.2 (for [i [1 0 1 0 1 0 1 0 0 0 2 0]]
|
||||
(aget warden-sheet 0 i)))
|
||||
warden-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 2 (repeat 20 0) 2])]
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
|
||||
(defn make [screen]
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-stash.atlas")
|
||||
candle-flame (utils/make-anim atlas "candle" [4 4] 0.1 (range 4))
|
||||
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
|
||||
|
||||
@@ -326,10 +326,8 @@
|
||||
(actions/talk entities :ego "Eww! He slobbered on my hand.")
|
||||
(actions/give entities :slobber))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/outside-castle.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
|
||||
peddler-talk (animation 0.18 (for [i (flatten [2 3 2 3 2 3 6 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 6 4 5 4 5 4 5 4 5])]
|
||||
(aget peddler-sheet 0 i)))
|
||||
peddler-stand (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 15 0) 6 (repeat 5 0) 4 5 4 5 4 5 (repeat 10 0)] )]
|
||||
|
||||
@@ -602,10 +602,8 @@
|
||||
(actions/talk entities :ego "That's a big cauldron!"))))
|
||||
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/outsidehouse.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
sheep-stand-sheet (texture! (utils/atlas->texture atlas "sheep-anim") :split 33 21)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [sheep-stand-sheet (texture! (utils/atlas->texture atlas "sheep-anim") :split 33 21)
|
||||
sheep-walk-sheet (texture! (utils/atlas->texture atlas "sheep-walk") :split 33 21)
|
||||
lamb-walk-sheet (texture! (utils/atlas->texture atlas "lamb-walk") :split 27 28)
|
||||
sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 11) (repeat 15 12)])]
|
||||
|
||||
@@ -93,9 +93,8 @@
|
||||
(actions/walk-straight-to entities :ego [142 96])
|
||||
(actions/talk entities :ego "This must be Frankie Rockfist's secret stash!")))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/outside-jail.atlas")
|
||||
guard-sheet (texture! (utils/atlas->texture atlas "guard") :split 37 87)
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [guard-sheet (texture! (utils/atlas->texture atlas "guard") :split 37 87)
|
||||
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
|
||||
guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i)))
|
||||
guard-sleep (utils/make-anim atlas "guard-sleep" [43 67] 0.1 (range 4))
|
||||
|
||||
@@ -182,9 +182,8 @@
|
||||
(defn grunt-vol [entities]
|
||||
(* 0.3 (get-in entities [:room :entities :bloodclot :opacity])))
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/space.atlas")
|
||||
bloodclot-head-talk-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [0 0 1 1 2 2 1 1 0 0 1 1 2 2 1 1 0 0 3 4 4 4 3 0 0 1 1 2 2 1 1 0 0 0 0 5 5 5 6 6 6 7 7 7])
|
||||
(defn make [screen atlas global-atlas]
|
||||
(let [bloodclot-head-talk-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [0 0 1 1 2 2 1 1 0 0 1 1 2 2 1 1 0 0 3 4 4 4 3 0 0 1 1 2 2 1 1 0 0 0 0 5 5 5 6 6 6 7 7 7])
|
||||
bloodclot-head-stand-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 3])
|
||||
bloodclot-head-shoot-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 10 11 10 11 10 11 10 11 10 11 10 11])
|
||||
bloodclot-head-keep-shoot-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [12 13])
|
||||
|
||||
@@ -1204,26 +1204,29 @@
|
||||
|
||||
_ (update! screen :shader shader)
|
||||
log-assets (fn [r] r)
|
||||
wrap (fn [maker]
|
||||
wrap (fn [maker atlas-file]
|
||||
(fn [screen]
|
||||
(-> (maker screen)
|
||||
(add-georgia screen global-atlas))))
|
||||
rooms {:inside-house (wrap rooms.inside-house/make)
|
||||
:inside-stash (wrap rooms.inside-stash/make)
|
||||
:outside-house (wrap rooms.outside-house/make)
|
||||
:behind-house (wrap rooms.behind-house/make)
|
||||
:cat-tree (wrap rooms.cat-tree/make)
|
||||
:inside-castle (wrap rooms.inside-castle/make)
|
||||
:space (wrap rooms.space/make)
|
||||
:held (wrap rooms.held/make)
|
||||
:inside-cafeteria (wrap rooms.inside-cafeteria/make)
|
||||
:inside-antique (wrap rooms.inside-antique/make)
|
||||
:inside-jail (wrap rooms.inside-jail/make)
|
||||
:dream (wrap rooms.dream/make)
|
||||
:ending (wrap rooms.ending/make)
|
||||
:castle-gate (wrap rooms.castle-gate/make)
|
||||
:outside-jail (wrap rooms.outside-jail/make)
|
||||
:outside-castle (wrap rooms.outside-castle/make) }
|
||||
(let [[screen atlas] (utils/acquire-atlas screen atlas-file :room)
|
||||
[screen global-atlas ] (utils/acquire-atlas screen "packed/global.atlas" :room)]
|
||||
|
||||
(-> (maker screen atlas global-atlas)
|
||||
(add-georgia screen global-atlas)))))
|
||||
rooms {:inside-house (wrap rooms.inside-house/make "packed/inside-house.atlas")
|
||||
:inside-stash (wrap rooms.inside-stash/make "packed/inside-stash.atlas")
|
||||
:outside-house (wrap rooms.outside-house/make "packed/outsidehouse.atlas")
|
||||
:behind-house (wrap rooms.behind-house/make "packed/behindhouse.atlas")
|
||||
:cat-tree (wrap rooms.cat-tree/make "packed/cat-tree.atlas")
|
||||
:inside-castle (wrap rooms.inside-castle/make "packed/inside-castle.atlas")
|
||||
:space (wrap rooms.space/make "packed/space.atlas")
|
||||
:held (wrap rooms.held/make "packed/held.atlas")
|
||||
:inside-cafeteria (wrap rooms.inside-cafeteria/make "packed/inside-cafeteria.atlas")
|
||||
:inside-antique (wrap rooms.inside-antique/make "packed/inside-antique.atlas")
|
||||
:inside-jail (wrap rooms.inside-jail/make "packed/inside-jail.atlas")
|
||||
:dream (wrap rooms.dream/make "packed/dream.atlas")
|
||||
:ending (wrap rooms.ending/make "packed/ending.atlas")
|
||||
:castle-gate (wrap rooms.castle-gate/make "packed/castle-gate.atlas")
|
||||
:outside-jail (wrap rooms.outside-jail/make "packed/outside-jail.atlas")
|
||||
:outside-castle (wrap rooms.outside-castle/make "packed/outside-castle.atlas") }
|
||||
entities {:rooms rooms
|
||||
:step-particles (assoc (particle-effect "particles/step") :x 100 :y 100 :baseline 241)
|
||||
:cam {:zoom utils/min-zoom
|
||||
@@ -1479,6 +1482,9 @@
|
||||
(assoc-in [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||
:finish #(do
|
||||
(-> screen
|
||||
(utils/release-resources :room)
|
||||
(utils/release-resources :default))
|
||||
(utils/stop-all-sounds! %)
|
||||
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen))
|
||||
%))))))
|
||||
|
||||
@@ -766,18 +766,29 @@
|
||||
(recur r#))))))))
|
||||
|
||||
|
||||
(defn acquire-atlas [{:keys [resources] :as screen :or {resources []}} file]
|
||||
(let [atlas (texture-atlas file)]
|
||||
(update! screen :resources
|
||||
(conj resources file))
|
||||
[(assoc screen :resources (conj resources file))
|
||||
atlas]))
|
||||
(defn acquire-atlas
|
||||
([screen file]
|
||||
(acquire-atlas screen file :default))
|
||||
([screen file id]
|
||||
(let [resources (get-in screen [:resources id] [])
|
||||
atlas (texture-atlas file)]
|
||||
(update! screen :resources
|
||||
(assoc (:resources screen) id (conj resources file)))
|
||||
[(assoc-in screen [:resources id] (conj resources file))
|
||||
atlas])))
|
||||
|
||||
(defn release-resources [screen]
|
||||
(doseq [resource (:resources screen)]
|
||||
(asset-manager! *asset-manager* :unload resource))
|
||||
(update! screen :resources [])
|
||||
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*))))
|
||||
(defn release-resources
|
||||
([screen]
|
||||
(release-resources screen :default))
|
||||
([screen id]
|
||||
(println (:resources screen))
|
||||
|
||||
(doseq [resource (id (:resources screen))]
|
||||
(println "releasing " resource)
|
||||
(asset-manager! *asset-manager* :unload resource))
|
||||
|
||||
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*)))
|
||||
(update! screen :resources (assoc (:resources screen {}) id []))))
|
||||
|
||||
(defn make-anim-seq
|
||||
([file [w h] speed frames]
|
||||
|
||||
Reference in New Issue
Block a user