Added some shopkeeper dialogue.

This commit is contained in:
2014-11-08 11:07:30 -08:00
parent d450d4ffe7
commit 4ca73be6eb
3 changed files with 75 additions and 12 deletions

View File

@@ -10,17 +10,77 @@
[play-clj.g2d :refer :all]))
(defn do-antique-dialogue [entities]
(actions/do-dialogue entities
:shopkeep "Welcome to my antique shop!"
:shopkeep "Can I help you?")
(actions/present-choices entities
{:choices ["What do you have for sale here?"
{:run #(actions/respond entities %
:shopkeep "For sale?"
:shopkeep "This is a very UNIQUE antique shop."
:shopkeep "Nothing's for sale, sonny."
:shopkeep "It's more like a museum."
:shopkeep "You can take look around at some of my items, but nothing is for sale.")
:choices ["How do you make money then?"
{:run #(actions/respond entities %
:shopkeep "Mostly insurance claims."
:shopkeep "When you run such an impressive shop as I do, items sometimes just go missing.")
:choices actions/previous-choices}
"Is there anything here you will sell?"
{:run #(actions/respond entities %
:shopkeep "No."
:shopkeep "But I do have some free magical fire mints that Gandarf brewed up."
:shopkeep "Careful! They're spicy.")
:choices actions/previous-choices}
"So in order to continue on my quest, I'll need to solve some puzzle here?"
{:run #(actions/respond entities %
:shopkeep "I have no idea what you're talking about, sonny.")
:choices actions/previous-choices}
"Something else"
{:choices actions/something-else}]}
(when (get-in @entities [:state :wants-toy])
"Listen, I really need that teddy bear you have.")
{:run #(actions/respond entities %
:shopkeep "Why?"
:shopkeep "Why should I give it to you?")
:choices ["I just need it ok?"
{:run #(actions/respond entities %
:shopkeep "I'm sorry, it's not for sale.")
:choices actions/something-else}
(when (get-in @entities [:state :knows-about-son])
"Your long lost son said I could have it.")
{:run #(actions/respond entities % :shopkeep "REALLY? You've met him?")}]}
"How's life in the antique shop biz?"
{:run #(do (actions/update-state entities (fn [state] (assoc state :knows-about-son true)))
(actions/respond entities %
:shopkeep "Pretty lonely."
:shopkeep "My long lost son used to help me run this shop, but he's been gone for five years now."
:shopkeep "I've been couped up in here by myself ever since."
:shopkeep "Now all I have is this grandfather clock to keep me company."))
:choices actions/previous-choices}
"Nevermind." {:run #(actions/respond entities % :shopkeep "Feel free to look around.")}]}))
(defn make [screen]
(rooms/make :music :inside-antique
:interactions
{:down {:box [60 0 290 25]
:cursor :down
:script (actions/get-script entities
(actions/walk-to entities :ego [222 3])
(actions/transition-background entities :inside-castle [182 90]))}}
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)]
:entities {}
:collision "inside-antique/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)))
(let [shopkeep-sheet (texture! (texture "inside-antique/shopkeep-talk.png") :split 18 21)
shopkeep-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 1 (repeat 50 0) 1 0 1 0 1])]
(aget shopkeep-sheet 0 i)))
shopkeep-talk (animation 0.15 (for [i [0 2 0 2 0 3 1 0]]
(aget shopkeep-sheet 0 i)))]
(rooms/make :music :inside-antique
:interactions
{:down {:box [60 0 290 25]
:cursor :down
:script (actions/get-script entities
(actions/walk-to entities :ego [222 3])
(actions/transition-background entities :inside-castle [182 90]))}}
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)]
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 137 :y 128 :baseline 112
:stand shopkeep-stand
:talk shopkeep-talk
:script (actions/get-script entities (do-antique-dialogue entities))
)
:stand)}
:collision "inside-antique/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50))))

View File

@@ -45,6 +45,7 @@
:script (actions/get-script
entities
(actions/walk-to entities :ego [191 90])
(actions/update-state entities (fn [state] (assoc state :wants-toy true)))
(actions/do-dialogue entities
:ego "Hello there, peddler."
:peddler "Good day sir! Care to see any of my wares?"
@@ -58,7 +59,9 @@
:peddler "An excellent selection! It is the choicest of balloons you'll ever find."
:peddler "This bundle of joy will only set you back 75 sheckels."
:ego "But I haven't got any money!"
:peddler "Then you won't have the choicest of balloons.")
:peddler "Then you won't have the choicest of balloons."
:peddler "I could, however, give you the balloon if you could procure for me a ware I'm missing."
:peddler "A child's toy. And I mean the choicest of children's toys.")
(actions/give entities items/balloon))}}
:layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
:entities {:peddler (actions/start-animation screen