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,8 +68,14 @@
: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)
(do (actions/do-dialogue entities
:ego "Hello there, peddler."
:peddler "Hello again, sir! I trust you are enjoying your goods!"
:ego "I sure am."
:peddler "I thought so!"))
(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 "Good day sir! Care to see any of my wares?"
:peddler "I have only the choicest of wares." :peddler "I have only the choicest of wares."
@@ -116,8 +122,10 @@
:peddler "Well I'm afraid you won't have the choicest of motivational tapes." :peddler "Well I'm afraid you won't have the choicest of motivational tapes."
:ego "Is there anything else you'd take instead?" :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."))} :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.")}]})) "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}))