more detail with antique shop and sword.

This commit is contained in:
2014-12-10 19:12:34 -08:00
parent e7c2acead2
commit bbfc1a6fec
5 changed files with 50 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -109,4 +109,5 @@
:scripts {:slobber (make-strength-potion)}}
:medal {:name "Medal of strength" :value :medal :cursor :medal}
:certificate {:name "Certificate of courage" :value :certificate :cursor :certificate}
:sword {:name "Sword of Blergh" :value :sword :cursor :sword}
})

View File

@@ -39,7 +39,8 @@
:choices actions/previous-choices}
"Something else"
{:choices actions/something-else}]}
(when (get-in @entities [:state :wants-toy])
(when (and (get-in @entities [:state :wants-toy])
(not (get-in @entities [:state :allowed-to-keep-teddy?])))
"Listen, I really need that teddy bear you have.")
{:run #(actions/respond entities %
:shopkeep "Why?"
@@ -67,7 +68,8 @@
:shopkeep "Yes, that's it!"
:shopkeep "You must have really met my son!"
:shopkeep "Of course you can keep the teddy bear.")
(actions/give entities :teddy))}]}]}
(actions/update-state entities (fn [s] (assoc s :allowed-to-keep-teddy? true))))}]}]}
"How's life in the antique shop biz?"
{:run #(actions/respond entities %
:shopkeep "Pretty lonely."
@@ -78,6 +80,10 @@
"Nevermind." {:run #(actions/respond entities % :shopkeep "Feel free to look around.")}]}))
(defn has-to-return-teddy? [entities]
(and (actions/has-item? entities :teddy)
(not (get-in @entities [:state :allowed-to-keep-teddy?]))))
(defn make [screen]
(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])]
@@ -93,19 +99,41 @@
(actions/play-animation entities :ego :reach)
(actions/talk entities :ego "It's a portrait. There's something on the back but I can't read it.")
(actions/remove-entity entities :portrait)
(actions/give entities :portrait))))]
(actions/give entities :portrait))))
teddy (assoc (texture "inside-antique/teddy.png")
:x 250
:y 80
:baseline 160
:script (actions/get-script entities
(actions/walk-to entities :ego [220 35] :face :right)
(actions/play-animation entities :ego :reach)
(actions/give entities :teddy)
(actions/remove-entity entities :teddy)
(when (not (get-in @entities [:state :allowed-to-keep-teddy?]))
(actions/do-dialogue entities
:ego "Aww, a cute teddy bear!"
:shopkeep "Don't get any fast ideas."
:shopkeep "That teddy bear does not leave my store."))))]
(rooms/make :music :inside-antique
:interactions
{:down {:box [60 0 290 25]
:cursor :down
:script (actions/get-script entities
(when (actions/has-item? entities :portrait)
(when (or (actions/has-item? entities :portrait)
(has-to-return-teddy? entities))
(actions/walk-to entities :ego [222 3])
(actions/talk entities :shopkeep "Excuse me sonny. Please return my belongings before you leave.")
(actions/walk-to entities :ego [136 80] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait portrait)
(actions/remove-item entities :portrait))
(when (actions/has-item? entities :portrait)
(actions/walk-to entities :ego [136 80] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait portrait)
(actions/remove-item entities :portrait))
(when (has-to-return-teddy? entities)
(actions/walk-to entities :ego [220 35] :face :right)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :teddy teddy)
(actions/remove-item entities :teddy)))
(actions/walk-to entities :ego [222 3])
(actions/transition-background entities :inside-castle [182 90]))}
:window {:box [212 130 256 180]
@@ -121,6 +149,10 @@
:stand shopkeep-stand
:talk shopkeep-talk
:script (actions/get-script entities (do-antique-dialogue entities))
:scripts {:teddy (actions/get-script entities
(if (get-in @entities [:state :allowed-to-keep-teddy?])
(actions/talk entities :shopkeep "Please give the teddy bear to Herb when you see him.")
(actions/talk entities :shopkeep "That belonged to my long lost son.")))}
)
:stand)
:portrait portrait
@@ -142,7 +174,13 @@
(actions/talk entities :ego "WOWZA! Those are hot.")
(when (= 3 (get-in @entities [:state :mints-eaten]))
(actions/talk entities :shopkeep "You brat! You ate the last mint.")
(actions/talk entities :shopkeep "Since you ate the last one, you have to go tell Gandarf to bring me some more."))))))}
(actions/talk entities :shopkeep "Since you ate the last one, you have to go tell Gandarf to bring me some more."))))))
:teddy teddy}
:collision "inside-antique/collision.png"
:apply-state (fn [entities]
(as-> entities entities
(if (actions/has-obtained? entities :teddy)
(update-in entities [:room :entities] #(dissoc % :teddy))
entities)))
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)
:start-pos [222 3])))

View File

@@ -101,11 +101,10 @@
(defn pull-sword [entities]
(actions/play-animation entities :ego :reach)
(actions/give entities :sword)
(actions/talk entities :ego "I got it! I will become the greatest knight Remington has ever known!"))
(defn try-to-pull-sword [entities missing-items obtained-items]
(actions/give entities :certificate)
(actions/give entities :medal)
(let [item->proof {:trophy "wisdom" :medal "strength" :certificate "courage"}]
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities

View File

@@ -13,7 +13,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 :certificate])
(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 :certificate :sword])
(defn cursor [filename which]
(let [scale 2