more detail on castle screen.

This commit is contained in:
2014-12-09 16:16:57 -08:00
parent 546bbccb3d
commit bb7dcb3628
4 changed files with 72 additions and 54 deletions

View File

@@ -29,6 +29,14 @@
((set (get-in entities [:state :inventory])) item) ((set (get-in entities [:state :inventory])) item)
((set (get-in @entities [:state :inventory])) item))) ((set (get-in @entities [:state :inventory])) item)))
(defn has-obtained? [entities item]
(if (map? entities)
((get-in entities [:state :obtained-items]) item)
((get-in @entities [:state :obtained-items]) item)))
(defn has-obtained-one-of? [entities items]
(seq (set/intersection (get-in entities [:state :obtained-items]) (set items))))
(defn has-one-of? [entities items] (defn has-one-of? [entities items]
(seq (set/intersection (set (get-in entities [:state :inventory])) (set items)))) (seq (set/intersection (set (get-in entities [:state :inventory])) (set items))))
@@ -346,6 +354,7 @@
(-> entities (-> entities
(update-in [:state :inventory] #(conj % item)) (update-in [:state :inventory] #(conj % item))
(update-in [:state :obtained-items] #(conj % item))
(assoc-in [:cursor :current] ((:all-items entities) item)))) (assoc-in [:cursor :current] ((:all-items entities) item))))
(continue [this screen entities] entities) (continue [this screen entities] entities)

View File

@@ -26,7 +26,7 @@
:mushrooms {:box [247 59 269 76] :mushrooms {:box [247 59 269 76]
:script (actions/get-script :script (actions/get-script
entities entities
(if (actions/has-item? entities :mushrooms) (if (actions/has-obtained? entities :mushrooms)
(actions/talk entities :ego "I've already got a junk ton of mushrooms.") (actions/talk entities :ego "I've already got a junk ton of mushrooms.")
(do (do
(actions/walk-to entities :ego [242 75]) (actions/walk-to entities :ego [242 75])
@@ -74,7 +74,7 @@
(if (get-in entities [:state :opened-crack?]) (if (get-in entities [:state :opened-crack?])
(assoc-in entities [:room :entities :peeling :opacity] 0) (assoc-in entities [:room :entities :peeling :opacity] 0)
entities) entities)
(if (actions/has-one-of? entities [:stick :cat-toy]) (if (actions/has-obtained? entities :stick)
(update-in entities [:room :entities] #(dissoc % :stick)) (update-in entities [:room :entities] #(dissoc % :stick))
entities))) entities)))
:start-pos [172 122])) :start-pos [172 122]))

View File

@@ -17,7 +17,7 @@
peddler-stand (animation 0.2 (for [i (flatten [(repeat 5 0) 6])] peddler-stand (animation 0.2 (for [i (flatten [(repeat 5 0) 6])]
(aget peddler-sheet 0 i))) (aget peddler-sheet 0 i)))
balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36) balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36)
balloon-stand (animation 0.3 (for [i [0 1 2 1]] balloon-stand (animation 0.25 (for [i [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 1 2]]
(aget balloon-sheet 0 i))) (aget balloon-sheet 0 i)))
bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2) bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2)
bird-stand (animation 0.15 (for [i [0 1]] bird-stand (animation 0.15 (for [i [0 1]]
@@ -56,7 +56,7 @@
:garden {:box [103 170 178 200] :garden {:box [103 170 178 200]
:script (actions/get-script :script (actions/get-script
entities entities
(if (actions/has-item? entities :carrot) (if (actions/has-obtained? entities :carrot)
(actions/talk entities :ego "If I steal any more, I might get caught.") (actions/talk entities :ego "If I steal any more, I might get caught.")
(do (do
(actions/walk-to entities :ego [128 180]) (actions/walk-to entities :ego [128 180])
@@ -68,56 +68,64 @@
:script (actions/get-script :script (actions/get-script
entities entities
(actions/walk-to entities :ego [191 90] :face :left) (actions/walk-to entities :ego [191 90] :face :left)
(if (actions/has-obtained? entities :balloon)
(actions/do-dialogue entities (do (actions/do-dialogue entities
:ego "Hello there, peddler." :ego "Hello there, peddler."
:peddler "Good day sir! Care to see any of my wares?" :peddler "Hello again, sir! I trust you are enjoying your goods!"
:peddler "I have only the choicest of wares." :ego "I sure am."
:ego "What 'wares' are you selling?" :peddler "I thought so!"))
:peddler "I have the choicest of all types of wares..."
:peddler "...I'm well stocked on used earplugs..." (do (actions/do-dialogue entities
:peddler "...glass eyes..." :ego "Hello there, peddler."
:peddler "... and motivational tapes." :peddler "Good day sir! Care to see any of my wares?"
:peddler "And today, I have a one day special!" :peddler "I have only the choicest of wares."
:peddler "Every purchase comes with a free balloon!") :ego "What 'wares' are you selling?"
(actions/present-choices entities {:choices ["I'm interested in your earplugs." :peddler "I have the choicest of all types of wares..."
{:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) :peddler "...I'm well stocked on used earplugs..."
(actions/respond entities % :peddler "...glass eyes..."
:peddler "A choice choice sir!" :peddler "... and motivational tapes."
:peddler "These earplugs have been used by the the choicest of wearers." :peddler "And today, I have a one day special!"
:peddler "I can see a young man like yourself enjoying these choice earplugs for ages to come!" :peddler "Every purchase comes with a free balloon!")
:peddler "And remember, every purchase comes with the choicest of balloons!" (actions/present-choices entities {:choices ["I'm interested in your earplugs."
:peddler "That'll just be 10 sheckels." {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true)))
:ego "But I haven't got any money!" (actions/respond entities %
:peddler "Well I'm afraid you won't have the choicest of earplugs." :peddler "A choice choice sir!"
:ego "Can't I give you something else for them?" :peddler "These earplugs have been used by the the choicest of wearers."
:peddler "Well, I am low on choice children's toys." :peddler "I can see a young man like yourself enjoying these choice earplugs for ages to come!"
:peddler "If you can bring me one, and I mean the choicest of toys, I will give you the earplugs."))} :peddler "And remember, every purchase comes with the choicest of balloons!"
"I'm interested in a glass eye." :peddler "That'll just be 10 sheckels."
{:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) :ego "But I haven't got any money!"
(actions/respond entities % :peddler "Well I'm afraid you won't have the choicest of earplugs."
:peddler "The choicest choice, young man!" :ego "Can't I give you something else for them?"
:peddler "This glass eye is made out of the choicest glass, from across the sea." :peddler "Well, I am low on choice children's toys."
:peddler "And remember, every purchase comes with the choicest of balloons!" :peddler "If you can bring me one, and I mean the choicest of toys, I will give you the earplugs."))}
:peddler "That'll just be 95 sheckels." "I'm interested in a glass eye."
:ego "But I haven't got any money!" {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true)))
:peddler "Well I'm afraid you won't have the choicest of glass eyes." (actions/respond entities %
:ego "Can't I give you something else for them?" :peddler "The choicest choice, young man!"
:peddler "I'll tell you what, I don't have any thing for the kids that come to my stand." :peddler "This glass eye is made out of the choicest glass, from across the sea."
:peddler "If you can bring me the choicest of toys, I will give you the glass eye."))} :peddler "And remember, every purchase comes with the choicest of balloons!"
"I'm interested in the motivational tapes." :peddler "That'll just be 95 sheckels."
{:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) :ego "But I haven't got any money!"
(actions/respond entities % :peddler "Well I'm afraid you won't have the choicest of glass eyes."
:peddler "Sure thing!" :ego "Can't I give you something else for them?"
:peddler "Has your luck got you down? Feeling pathetic?" :peddler "I'll tell you what, I don't have any thing for the kids that come to my stand."
:peddler "These choicest of motivation tapes will convince you that life isn't so bad." :peddler "If you can bring me the choicest of toys, I will give you the glass eye."))}
:peddler "For only 3 easy payments of 29.99 scheckles, they're yours!" "I'm interested in the motivational tapes."
:ego "But I'm broke!" {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true)))
:peddler "Well I'm afraid you won't have the choicest of motivational tapes." (actions/respond entities %
:ego "Is there anything else you'd take instead?" :peddler "Sure thing!"
:peddler "If you can bring me a nice kid's toy, I will give you the tapes."))} :peddler "Has your luck got you down? Feeling pathetic?"
"Nevermind." {:run #(actions/respond entities % :peddler "Goodbye, sir.")}]})) :peddler "These choicest of motivation tapes will convince you that life isn't so bad."
:peddler "For only 3 easy payments of 29.99 scheckles, they're yours!"
:ego "But I'm broke!"
:peddler "Well I'm afraid you won't have the choicest of motivational tapes."
:ego "Is there anything else you'd take instead?"
:peddler "If you can bring me a nice kid's toy, I will give you the tapes."))}
"Nevermind." {:run #(actions/respond entities % :peddler "Goodbye, sir.")}]})))
)
:scripts {:teddy (actions/get-script entities :scripts {:teddy (actions/get-script entities
(actions/walk-to entities :ego [191 90] :face :left)
(actions/remove-item entities :teddy) (actions/remove-item entities :teddy)
(actions/do-dialogue entities (actions/do-dialogue entities
:peddler "That is the choicest of teddy bears!" :peddler "That is the choicest of teddy bears!"
@@ -195,7 +203,7 @@
:stand) :stand)
:flies (actions/start-animation screen :flies (actions/start-animation screen
(assoc (animation->texture screen flies-stand) (assoc (animation->texture screen flies-stand)
:x 241 :x 201
:y 175 :y 175
:baseline 240 :baseline 240
:stand flies-stand) :stand flies-stand)

View File

@@ -219,6 +219,7 @@
{:object nil {:object nil
:active? true :active? true
:last-room :outside-house :last-room :outside-house
:obtained-items #{}
:inventory [] :inventory []
:clues #{} :clues #{}
:mints-eaten 0})) :mints-eaten 0}))