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]))