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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 KiB

After

Width:  |  Height:  |  Size: 673 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

After

Width:  |  Height:  |  Size: 398 KiB

View File

@@ -12,6 +12,7 @@
[advent.actions :as actions]
[advent.screens.dialogue :as dialogue]
[advent.utils :as utils]
[advent.screens.rooms :as rooms]
[advent.tween :as tween]
[advent.tween :as tween]
[clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]])
@@ -283,7 +284,7 @@
(done? [this screen entities]
(animation! (find-animation (get-in entities [:room :entities target-id ]) anim)
:is-animation-finished
(- (:total-time screen) (get-in entities [:room :entities target-id :anim-start]))))
(- (:total-time screen) (doto (get-in entities [:room :entities target-id :anim-start]) println))))
(terminate [this screen entities]
(if continue?
@@ -964,3 +965,55 @@
(actions/talk entities :ego (first msgs) :anim :squat-talk :stop? false)
(Thread/sleep 200)
(recur entities (rest msgs)))))
(defn wait [entities time]
(let [initial-time (atom nil)]
(run-action entities
(begin [this screen entities]
(reset! initial-time (:total-time screen))
entities)
(continue [this screen entities] entities)
(done? [this screen entities]
(> (* 1000 (- (:total-time screen)
@initial-time))
time))
(terminate [this screen entities]
entities)
(skip-type [this screen entities]
:none))))
(defn play-safe [entities]
(let [safe-song-anim (utils/make-anim-seq "safe-song/safe-song" [100 35] 0.05 (flatten
[
[1 2 3]
(repeat 2 [
[5 6 7 8 8 7 6 6 6 6 6]
(map (partial + 4) [5 6 7 8 8 7 6 6 6 6 6])
(map (partial + 8) [5 6 7 8 8 7 6 6 6 6 6])
(map (partial + 12) [5 6 7 8 8 7 6 6 6 6 6])
18 18 18 18
(map (partial + 16) [5 6 7 8 8 7 6 6 6 6 6])
(repeat 45 22)])
[22 22 22 22 22 22 22 22 26 27 28]
]))]
(Thread/sleep 200)
(add-entity entities :safe-song
(rooms/make-entity :safe-song
(assoc (utils/get-texture "safe-song/safe-song-1")
:x 130
:y 120
:baseline 241
:anim nil
:anim-start 0
:play safe-song-anim)))
(begin-animation entities :safe-song :play)
(wait entities 100)
(play-sound entities "safe-sound.ogg" 0.1 false)
(wait entities 10000)
(remove-entity entities :safe-song)))

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.")

View File

@@ -27,7 +27,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(log/info (:input-x screen) (:input-y screen) "->" x y)))
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :charcoal :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom])
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :charcoal :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom :tune])
(def settings (atom {:music-volume 50.0
:sound-volume 75.0