inventory item for song.

This commit is contained in:
Bryce Covert
2016-06-15 13:04:28 -07:00
parent b21c2d0174
commit 80a9160f32
11 changed files with 606 additions and 308 deletions

View File

@@ -168,4 +168,5 @@
:magic-slingshot {:name "The Slinger's Shot" :value :magic-slingshot :cursor :magic-slingshot}
:shovel {:name "Shovel" :value :shovel :cursor :shovel}
:broom {:name "Broom" :value :broom :cursor :broom}
:dream-sword {:name "Sword" :value :dream-sword :cursor :sword}})
:dream-sword {:name "Sword" :value :dream-sword :cursor :sword}
:tune {:name "A Safe's Sound" :value :tune :cursor :tune}})

View File

@@ -24,6 +24,10 @@
(actions/walk-to entities :ego [158 110]))
:cursor :left})
(defn increment-safe-listens [entities]
(actions/update-state entities
(fn [state] (assoc state :safe-listen-count (inc (:safe-listen-count state 0))))))
(defn make [screen]
(rooms/make :music {:day :town-2 :night :night}
:name "Behind house"
@@ -62,10 +66,10 @@
(assoc (utils/get-texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
:night [(assoc (utils/get-texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)
(assoc (utils/get-texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
(assoc (utils/get-texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)
(assoc (utils/get-texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
:entities {:stick (assoc (utils/get-texture "behindhouse/stick.png")
:x 26 :y 80 :baseline 160
:script (actions/get-script entities
@@ -74,13 +78,16 @@
(actions/remove-entity entities :stick)
(actions/give entities :stick)
(actions/talk entities :ego "This stick might be useful.")))
:peeling (assoc (utils/get-texture "behindhouse/house-cover.png")
:x 60 :y 92 :baseline 148
:script (actions/get-script entities
(cond (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "The house is empty right now.")
(get-in @entities [:state :opened-crack?])
(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)
@@ -90,7 +97,23 @@
(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)))
(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 Magi-safe." :animate? false :stop? false)
(actions/play-sound entities "safe-sound.ogg" 0.1)
(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.")
:else
(do (actions/walk-to entities :ego [80 80] :face :left)

View File

@@ -314,6 +314,17 @@ void main ()
:camera
(common/one-liner "It's some sort of magical device that captures images.")
:tune
(actions/get-script entities
(if (get-in @entities [:room :entities :wizard])
(do
(actions/talk entities :ego "Better not hum it with Gandarf around!")
(actions/talk entities :wizard "What's that, boy?")
(actions/talk entities :ego "Oh... Erm... Nothing."))
(do
(actions/talk entities :ego "Ugh! I have Gandarf's MagicSafe 2000 tune stuck in my head.")
(actions/play-safe entities))))
:alarm-clock
(common/one-liner "It's a magic device that tells the time.")