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

@@ -1 +1 @@
{:active? true, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:rope :key :crowbar :ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword), :wizard-left? false, :dropped-ball? true, :clues #{}, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-house, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:key :rope :kiss :medal :sword :flask-1 :grass :ladder :trophy :crowbar :ball-n-chain}}
{:active? true, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:key :recipe :crowbar :rope :ladder :grass :medal :kiss :trophy :flask-1-strength :sword), :wizard-left? false, :dropped-ball? true, :hay-searches 4, :clues #{}, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-house, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:key :rope :kiss :medal :sword :flask-1 :grass :ladder :trophy :crowbar :ball-n-chain}}

View File

@@ -1 +1 @@
{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night}
{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :recipe :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night}

View File

@@ -1 +1 @@
{:active? true, :convinced-wizard? true, :inventory [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day}
{:active? true, :convinced-wizard? true, :inventory [:ladder :recipe :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,15 +1,6 @@
(ns advent.screens.items
(:require [advent.actions :as actions]))
(declare stick)
(declare wool)
(declare cat-toy)
(declare flask-1-with-milk)
(declare slobber)
(declare flask-1-strength)
(declare flask-1-with-cream-of-mushroom)
(def make-cat-toy
(actions/get-script entities
(actions/remove-item entities :stick)
@@ -17,12 +8,6 @@
(actions/give entities :cat-toy)
(actions/talk entities :ego "It makes a little cat toy!")))
(def wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}})
(def mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms})
(def carrot {:name "Carrot" :value :carrot :cursor :carrot})
(def flask-1-with-mushrooms {:name "Flask with mushrooms" :value :flask-1-with-mushrooms :cursor :flask-with-contents})
(defn make-cream-of-mushroom [entities]
(actions/remove-item entities :flask-1-with-mushrooms)
(actions/remove-item entities :flask-1-with-milk)
@@ -30,30 +15,6 @@
(actions/give entities :flask-1-with-cream-of-mushroom)
(actions/talk entities :ego "It's just like cream of mushroom soup."))
(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-strength})
(def flask-1 {:name "Flask" :value :flask-1 :cursor :flask
:scripts {:mushrooms (actions/get-script entities
(actions/remove-item entities :flask-1)
(actions/remove-item entities :mushrooms)
(actions/give entities :flask-1-with-mushrooms)
(actions/talk entities :ego "I'll just put a few of these in here."))}})
(def trophy {:name "Trophy of wisdom" :value :trophy :cursor :trophy})
(def cheat-deck {:name "Warlock's Tower cheat deck" :value :cheat-deck :cursor :cheat-deck})
(def cat-toy {:name "Cat toy" :value :cat-toy :cursor :cat-toy})
(def stick {:name "Stick" :value :stick :cursor :stick :scripts {:wool make-cat-toy}})
(def balloon {:name "Choicest of balloons" :value :balloon :cursor :balloon})
(def frog-legs {:name "Frog legs" :value :frog-legs :cursor :frog-legs})
(def ladder {:name "ladder" :value :ladder :cursor :ladder})
(def teddy {:name "Teddy Bear" :value :teddy :cursor :teddy})
(def portrait {:name "Portrait" :value :portrait :cursor :portrait})
(def recipe {:name "Strength potion recipe" :value :recipe :cursor :recipe})
(def glass-eye {:name "Choicest of glass eyes" :value :glass-eye :cursor :glass-eye})
(def motivational-tapes {:name "Choicest motivational tapes" :value :motivational-tapes :cursor :motivational-tapes})
(def used-earplugs {:name "Choicest used earplugs" :value :used-earplugs :cursor :used-earplugs})
(def grass {:name "Huge grass" :value :grass :cursor :grass})
(defn add-slobber []
(actions/get-script entities
@@ -70,6 +31,12 @@
(actions/talk entities :ego "It's the completed strength potion!")))
(defn make-water-and-ash []
(actions/get-script entities
(actions/remove-item entities :flask-water)
(actions/remove-item entities :ash)
(actions/give entities :flask-water-ash)
(actions/talk entities :ego "I added the ashes to the water.")))
(def items
{:wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}}
@@ -115,4 +82,9 @@
:key {:name "Jail key" :value :key :cursor :key}
:rope {:name "Rope" :value :rope :cursor :rope}
:crowbar {:name "Crowbar" :value :crowbar :cursor :crowbar}
:flask-2 {:name "Flask" :value :flask-2 :cursor :flask}
:flask-water {:name "Water from fountain" :value :flask-water :cursor :flask :scripts {:ash (make-water-and-ash)}}
:flask-water-ash {:name "Water and ashes" :value :flask-water-ash :cursor :flask-with-contents}
:note-1 {:name "Note from Gandarf" :value :note-1 :cursor :note-1}
:ash {:name "Ashes" :value :ash :cursor :ash :scripts {:flask-water (make-water-and-ash)}}
})

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

View File

@@ -13,6 +13,7 @@
[advent.zone :as zone]
[advent.utils :as utils]
[advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.items :as items]
[advent.screens.rooms.outside-house :as rooms.outside-house]
[advent.screens.rooms.inside-house :as rooms.inside-house]
@@ -231,6 +232,7 @@
:ego "'A word of warning, before you go.\nA sip is all it takes to grow.'"
:ego "'Not more than that do drink,\nOr you'll push your body to the brink.'"
:ego "Hmm. I wonder what that last part means?"))
:note-1 (actions/get-script entities (common/read-note-1 entities))
nil))
:x (first start-pos) :y (last start-pos)
:id "ego"}]

View File

@@ -14,7 +14,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(println (: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])
(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])
(defn cursor [filename which]
(let [scale 2
@@ -114,3 +114,6 @@
(defn remove-interaction [entities id]
(update-in entities [:room :interactions] (fn [i] (remove #(= id (:id %)) i))))