Adding more of the nighttime puzzle.

This commit is contained in:
2014-12-28 12:23:03 -08:00
parent bc55fa4c28
commit 5debdd60dd
19 changed files with 182 additions and 92 deletions

View File

@@ -17,3 +17,38 @@
(actions/update-state entities #(assoc % :inventory []))
(actions/update-state entities #(assoc % :opened-bars? false))
(actions/transition-background entities :inside-jail [130 85]))
(defn make-wizard [screen wizard-spec]
(let [wizard-sheet (texture! (texture "wizard/talk.png") :split 20 46)
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
(aget wizard-sheet 0 i)))
wizard-disappear (utils/make-anim "wizard/disappear.png" [20 46] 0.075 (range 19))
wizard-talk (animation 0.2 (for [i [0 2 0 2 1 2 0 3 0 2 0 1 0 2]]
(aget wizard-sheet 0 i)))]
(actions/start-animation screen (merge (assoc (animation->texture screen wizard-stand)
:left {:talk (utils/flip wizard-talk)
:stand (utils/flip wizard-stand)
:disappear (utils/flip wizard-disappear)}
:right {:talk wizard-talk
:stand wizard-stand
:disappear wizard-disappear}
:talk-color (color 0.95 0.3 1.0 1.0)
:facing :left) wizard-spec)
:stand)))
(defn read-note-1 [entities]
(actions/do-dialogue entities
:ego "It's a note from Gandarf! It says:"
:ego "'Boy, I have been kidnapped by Blergh.'"
:ego "'He's got me locked up in his fortress of doom.'"
:ego "'It's actually pretty comfortable, despite the name.'"
:ego "'But you must hurry.'"
:ego "'You must cast the spell to restore magic to the Slinger's Shot yourself.'"
:ego "'I will do my best to help you along the way.'"
:ego "'You will need to add to your flask the ashes of magic, and the sound of buzzing.'"
:ego "'Then stir with the gift of flight.'"
:ego "'Then pour the contents in the cauldron.'"
:ego "'I will give you more instructions when I can.'"
:ego "'And please hurry, because we're being forced into a karaoke competition.'"
:ego "'I'm about at my witt's end.'"))

View File

@@ -1,6 +1,7 @@
(ns advent.screens.rooms.inside-house
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.safe :as safe]
[advent.actions :as actions]
[advent.utils :as utils]
@@ -101,13 +102,7 @@
{:run #(actions/do-dialogue entities :ego %)}]}))
(defn make [screen]
(let [wizard-sheet (texture! (texture "wizard/talk.png") :split 20 46)
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
(aget wizard-sheet 0 i)))
wizard-disappear (utils/make-anim "wizard/disappear.png" [20 46] 0.075 (range 19))
wizard-talk (animation 0.2 (for [i [0 2 0 2 1 2 0 3 0 2 0 1 0 2]]
(aget wizard-sheet 0 i)))
safelock-sheet (texture! (texture "inside-house/safe-lock.png") :split 9 2)
(let [safelock-sheet (texture! (texture "inside-house/safe-lock.png") :split 9 2)
safe-lock (animation 0.1 (for [i (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 ])]
(aget safelock-sheet 0 i)))
candle (utils/make-anim (texture "inside-house/candle.png") [34 32] 0.2 [1 0 1 2])]
@@ -136,45 +131,36 @@
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240)]
:entities {:wizard (actions/start-animation screen (assoc (animation->texture screen wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:left {:talk (utils/flip wizard-talk)
:stand (utils/flip wizard-stand)
:disappear (utils/flip wizard-disappear)}
:right {:talk wizard-talk
:stand wizard-stand
:disappear wizard-disappear}
:talk-color (color 0.95 0.3 1.0 1.0)
:facing :left
:script (actions/get-script entities (do-wizard-dialogue entities))
:scripts #(condp = %
:kiss (actions/get-script entities
(actions/do-dialogue entities
:wizard "Good job boy! You saved a damsel in distress."
:wizard "You have proven yourself worthy in courage."))
:medal (actions/get-script entities
(actions/do-dialogue entities
:wizard "So you beat Captain McHulk at arm wrestling? "
:wizard "You must have been working out!"))
:trophy (actions/get-script entities
(actions/do-dialogue entities
:wizard "My, my, you have proven your worth in wisdom!"
:wizard "One day you'll be as wise as me!"))
:recipe (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:frog-legs (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:mandrake (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:flask-1 (actions/get-script entities
(actions/do-dialogue entities
:wizard "You can keep the flask."))
(actions/get-script entities
(actions/do-dialogue entities
:wizard "No thank you."))))
:stand)
:entities {:wizard (common/make-wizard screen {:x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:script (actions/get-script entities (do-wizard-dialogue entities))
:scripts #(condp = %
:kiss (actions/get-script entities
(actions/do-dialogue entities
:wizard "Good job boy! You saved a damsel in distress."
:wizard "You have proven yourself worthy in courage."))
:medal (actions/get-script entities
(actions/do-dialogue entities
:wizard "So you beat Captain McHulk at arm wrestling? "
:wizard "You must have been working out!"))
:trophy (actions/get-script entities
(actions/do-dialogue entities
:wizard "My, my, you have proven your worth in wisdom!"
:wizard "One day you'll be as wise as me!"))
:recipe (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:frog-legs (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:mandrake (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen posessions."))
:flask-1 (actions/get-script entities
(actions/do-dialogue entities
:wizard "You can keep the flask."))
(actions/get-script entities
(actions/do-dialogue entities
:wizard "No thank you.")))})
:safe-lock (actions/start-animation screen (assoc (animation->texture screen safe-lock) :x 51 :y 95 :baseline 145
:stand safe-lock)
:stand)

View File

@@ -1,6 +1,7 @@
(ns advent.screens.rooms.outside-house
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -112,8 +113,49 @@
(actions/respond entities % :wizard "Now scram!")
(actions/transition-background entities :outside-house [262 88]))}]}))
(defn talk-to-gandarf-outside [entities]
(actions/walk-to entities :ego [120 80] :face :right)
(if (actions/has-item? entities :flask-2)
(actions/do-dialogue entities :wizard "Have you gotten me water from the fountain yet?"
:ego "No, not yet."
:wizard "Hurry, boy! Time's-a-wastin'!")
(do
(actions/do-dialogue entities :ego "Gandarf! Boy am I glad to see you."
:wizard "There is no time, boy."
:wizard "We must hurry if you are to defeat Blergh."
:ego "Wait, you knew about Blergh all along?"
:ego "And you never told me?"
:wizard "Honestly, I've always thought you were a loser."
:wizard "I never thought you'd be able to pull the sword."
:wizard "But we have to hurry."
:wizard "Blergh spent his entire time in sword prison making that helmet that zapped you."
:wizard "There's only one way to neutralize it:"
:wizard "The Slinger's Shot."
:wizard "It's a magical slingshot that has long lost its power."
:wizard "You and me, boy, we're going to return it to its powerful state."
:wizard "Then you can beat Blergh, come sunrise."
:wizard "Now, time is of the essence."
:wizard "Take this flask. Fill it with water from the fountain.")
(actions/give entities :flask-2))))
(defn add-wizard-if-necessary [entities]
(if (actions/has-item? entities :flask-water)
entities
(update-in entities [:room :entities] #(assoc % :wizard (get-in entities [:room :wizard])))))
(defn add-note-if-necessary [entities]
(if (and (actions/has-item? entities :flask-water)
(not (actions/has-obtained? entities :note-1)))
(update-in entities [:room :entities] #(assoc % :note (get-in entities [:room :note])))
entities))
(defn make-night [entities]
(update-in entities [:room :entities] #(dissoc % :butterfly)))
(-> entities
(update-in [:room :entities] #(dissoc % :butterfly))
(update-in [:room :entities] #(assoc % :cauldron (get-in entities [:room :cauldron])))
add-wizard-if-necessary
add-note-if-necessary))
(defn make [screen]
(let [sheep-stand-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
@@ -122,7 +164,8 @@
(aget sheep-stand-sheet 0 i)))
sheep-walk (animation 0.05 (for [i (range 6)]
(aget sheep-walk-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])]
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4))]
(rooms/make :music :town-2
:interactions
{:door {:box [258 100 281 160]
@@ -237,6 +280,27 @@
v (vector-2 0 0)
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))}
:cauldron (rooms/make-entity :cauldron (assoc (animation->texture screen cauldron)
:x 139 :y 73 :baseline 167
:anim cauldron
:anim-start 0
:script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!"))
:scripts {:recipe (actions/get-script entities
(actions/walk-to entities :ego [151 90] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-item entities :recipe)
(actions/give entities :ash)
(actions/talk entities :ego "It burned up into ash."))}))
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
:script (actions/get-script entities (talk-to-gandarf-outside entities))}))
:note (rooms/make-entity :note (assoc (texture "outsidehouse/note.png")
:x 286 :y 80 :baseline 160
:script (actions/get-script entities
(actions/walk-to entities :ego [280 80] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-entity entities :note)
(actions/give entities :note-1)
(common/read-note-1 entities))))
:collision "outsidehouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:apply-state (fn [entities]

View File

@@ -70,7 +70,13 @@
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities :ego "Ahh, life-giving water."
:ego "I feel strength."
:ego "And renewal!")))
:ego "And renewal!"))
:scripts {:flask-2 (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :flask-2)
(actions/give entities :flask-water)
(actions/talk entities :ego "Filled with water, just as Gandarf wanted."))})
:warden {:object nil
:x 36
:y 86