removing stuff that needs to go away at night.

This commit is contained in:
2014-12-27 23:26:10 -08:00
parent e6055f6941
commit bc55fa4c28
5 changed files with 84 additions and 37 deletions

View File

@@ -9,6 +9,9 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn make-night [entities]
(assoc-in entities [:room :entities :peeling :opacity] 0))
(defn make [screen]
(rooms/make :music :town-2
:interactions
@@ -37,9 +40,11 @@
:script (actions/get-script
entities
(actions/walk-to entities :ego [128 100])
(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."))}}
(if (= :night (get-in @entities [:state :time]))
(actions/do-dialogue entities :ego "The house is dark and empty.")
(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.")))}}
:layers {:day [(assoc (texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)]
@@ -53,25 +58,29 @@
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :stick)
(actions/give entities :stick)
(actions/talk entities :ego "This stick might be useful.")
))
(actions/talk entities :ego "This stick might be useful.")))
:peeling (assoc (texture "behindhouse/house-cover.png")
:x 60 :y 92 :baseline 148
:script (actions/get-script entities
(if (get-in @entities [:state :opened-crack?])
(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 Magi-safe." :animate? false :stop? false)
(actions/play-sound entities "safe-sound.ogg")
(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."))
(do (actions/walk-to entities :ego [80 80])
(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)))))))
(cond (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "The house is empty right now.")
(get-in @entities [:state :opened-crack?])
(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 Magi-safe." :animate? false :stop? false)
(actions/play-sound entities "safe-sound.ogg")
(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."))
: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)))))))
:bird (utils/make-bird screen [[50 235] [80 220] [100 239] [180 235] [85 225]])}
:collision "behindhouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
@@ -82,5 +91,8 @@
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]))

View File

@@ -92,6 +92,12 @@
(do-saved-grandma-dialogue entities)
(do-grandma-dialogue-with-cat entities)))
(defn make-night [entities]
(-> entities
(update-in [:room :entities] #(dissoc % :grandma))
(utils/remove-interaction :ladder-area)
(utils/remove-interaction :grandma)))
(defn make [screen]
(let [cat-stand-sheet (texture! (texture "cat-tree/cat-stand.png") :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])]
@@ -211,5 +217,8 @@
(as-> entities entities
(if (actions/has-item? entities :kiss)
(update-in entities [:room :entities] #(dissoc % :cat))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))
:start-pos [203 1])))

View File

@@ -148,6 +148,10 @@
", but still have to prove myself in "
(str/join " and " (map item->proof missing-items))
".")))))
(defn make-night [entities]
(update-in entities [:room :entities] #(dissoc % :game-player)))
(defn make [screen]
(let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44)
game-player-talk (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]]
@@ -170,8 +174,10 @@
:up-door {:box [50 150 70 170]
:script (actions/get-script entities
(actions/walk-to entities :ego [65 155])
(actions/transition-background entities :inside-cafeteria [319 55])
(actions/walk-to entities :ego [300 55]))
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
(do (actions/transition-background entities :inside-cafeteria [319 55])
(actions/walk-to entities :ego [300 55]))))
:cursor :up}
:antique-door {:box [154 90 189 150]
:cursor :up
@@ -179,14 +185,16 @@
(actions/walk-to entities :ego [182 90] :face :left)
(sound! (sound "door.ogg") :play)
(actions/play-animation entities :ego :reach)
(actions/transition-background entities :inside-antique [228 -30])
(actions/walk-straight-to entities :ego [222 15] :face :left)
(if (get-in @entities [:state :allowed-to-keep-teddy?])
(actions/do-dialogue entities :shopkeep "Hello there, sonny."
:shopkeep "Have you seen Herb lately?"
:ego "Erm... No, not recently."
:shopkeep "Oh. Send him my love if you do see him.")
(actions/talk entities :shopkeep "Hello there, sonny.")))}
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
(do (actions/transition-background entities :inside-antique [228 -30])
(actions/walk-straight-to entities :ego [222 15] :face :left)
(if (get-in @entities [:state :allowed-to-keep-teddy?])
(actions/do-dialogue entities :shopkeep "Hello there, sonny."
:shopkeep "Have you seen Herb lately?"
:ego "Erm... No, not recently."
:shopkeep "Oh. Send him my love if you do see him.")
(actions/talk entities :shopkeep "Hello there, sonny.")))))}
:sword {:box [0 130 39 165]
:script (actions/get-script entities
(if (actions/has-item? entities :sword)
@@ -320,5 +328,8 @@
entities)
(if (actions/has-item? entities :sword)
(update-in entities [:room :entities] #(dissoc % :sword))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))
:start-pos [245 90])))

View File

@@ -111,6 +111,10 @@
{:run #(do
(actions/respond entities % :wizard "Now scram!")
(actions/transition-background entities :outside-house [262 88]))}]}))
(defn make-night [entities]
(update-in entities [:room :entities] #(dissoc % :butterfly)))
(defn make [screen]
(let [sheep-stand-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
sheep-walk-sheet (texture! (texture "outsidehouse/sheep-walk.png") :split 33 21)
@@ -129,11 +133,13 @@
(actions/talk entities :ego (str "Anyone home?"))
(sound! (sound "door.ogg") :play)
(actions/play-animation entities :ego :reach)
(actions/transition-background entities :inside-house [237 0])
(if (get-in @entities [:state :convinced-wizard?])
(do (actions/talk entities :wizard (str "Oh, hello there boy."))
(utils/save @entities))
(wizard-dialogue entities)))
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
(do (actions/transition-background entities :inside-house [237 0])
(if (get-in @entities [:state :convinced-wizard?])
(do (actions/talk entities :wizard (str "Oh, hello there boy."))
(utils/save @entities))
(wizard-dialogue entities)))))
:cursor :right}
:right-dir {:box [220 141 320 224]
@@ -237,5 +243,8 @@
(as-> entities entities
(if (get-in entities [:state :coaxed-sheep?])
(update-in entities [:room :entities :sheep] #(assoc % :x 95 :y 150 :baseline 40))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))
:start-pos [30 80])))

View File

@@ -10,6 +10,10 @@
[play-clj.g2d :refer :all]))
(defn make-night [entities]
(-> entities
(assoc-in [:room :entities :guard] (get-in entities [:room :guard]))))
(defn make [screen]
(let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3))
guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
@@ -27,8 +31,10 @@
:cursor :down}
:door {:box [22 42 46 124]
:script (actions/get-script entities
(actions/walk-to entities :ego [50 46])
(actions/talk entities :warden "NO VISITORS!"))}
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "I do NOT want to go back in there!")
(do (actions/walk-to entities :ego [50 46])
(actions/talk entities :warden "NO VISITORS!"))))}
:window {:box [62 175 80 212]
:script (actions/get-script entities
(actions/talk entities :ego "I wonder if anyone is prisoner up there?"))}
@@ -82,7 +88,7 @@
:apply-state (fn [entities]
(as-> entities entities
(if (= :night (get-in entities [:state :time]))
(assoc-in entities [:room :entities :guard] (get-in entities [:room :guard]))
(make-night entities)
entities)
(if (get-in entities [:state :dropped-ball?])
(update-in entities [:room :entities :guard] #(actions/start-animation % :sleep))