From f41a9deae1b6a70ad86c602d4f06fa573ab9e35a Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 8 Jan 2015 13:23:30 -0800 Subject: [PATCH] more stash stuff. --- desktop/resources/inside-stash/lid.png | Bin 1084 -> 1081 bytes .../advent/screens/rooms/inside_stash.clj | 56 ++++++++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/desktop/resources/inside-stash/lid.png b/desktop/resources/inside-stash/lid.png index 3abdc421dd3a7750bea19e4770048607e5185959..3ba003e2e6754e030ff0659fc1988e68128499e5 100644 GIT binary patch delta 201 zcmdnPv6Ev%5EGN5!Q=-_Qj_zT6qpv1;YQ2nI8my9pDVybjFs?w5Gjw)@4&zsH{^rJUyY$+b)@g>mubbvid5OuoUa y%FN-GG?|e_TqXTjzI~l>gF%OH&JAW335M6go^M6=-|qrCfWgz%&t;ucLK6VuE=+r5EGN7^W+CiQj_zT6qqbsCQo4U;4m<@a5OhIump;mz&MUT8Oh0}%#KMc z|GvCqU|?9~>EaktaVzQ1|Nr&E%pz0Tc3d$EVAys2O{Uv3<3l{`k~ROX>26riGKJ|R z+y07g4F>~!d5?StN+*TTImz9`ie{{_Di%cTdz+exf}iY65G|xm}z7JI diff --git a/desktop/src-common/advent/screens/rooms/inside_stash.clj b/desktop/src-common/advent/screens/rooms/inside_stash.clj index ad737adf..e19f509f 100644 --- a/desktop/src-common/advent/screens/rooms/inside_stash.clj +++ b/desktop/src-common/advent/screens/rooms/inside_stash.clj @@ -9,6 +9,42 @@ [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) +(defn bust-chest [entities] + (if (get-in @entities [:state :broke-lock?]) + (do + (actions/talk entities :ego "I already bust it open.")) + (do + (actions/talk entities :ego "Let's see if this can pry this puppy open.") + (actions/walk-straight-to entities :ego [152 95] :face :right) + (actions/play-animation entities :ego :crowbar) + (actions/remove-entity entities :lid) + (actions/update-state entities #(assoc % :broke-lock? true)) + (actions/talk entities :ego "Got it!")))) + +(defn explore-chest [entities] + (cond + (actions/has-item? entities :slingshot) + (do (actions/walk-to entities :ego [152 95]) + (actions/talk entities :ego "It's empty now.")) + (get-in @entities [:state :broke-lock?]) + (do + (actions/walk-to entities :ego [152 95]) + (actions/talk entities :ego "Let's see what's inside now.") + (actions/play-animation entities :ego :reach) + (actions/do-dialogue entities + :ego "Yes! I got my stuff back!" + :ego "Including the Slinger's shot!") + (actions/give entities :flask-1-strength) + (actions/give entities :medal) + (actions/give entities :trophy) + (actions/give entities :slingshot)) + :else + (do + (actions/walk-to entities :ego [152 95]) + (actions/talk entities :ego "Maybe my stuff is in here...") + (actions/play-animation entities :ego :reach) + (actions/talk entities :ego "It's locked tight!")))) + (defn make [screen] @@ -22,19 +58,17 @@ (actions/walk-straight-to entities :ego [167 100])) :cursor :left} :chest {:box [151 107 180 124] - :script (actions/get-script entities - (actions/walk-to entities :ego [152 95]) - (actions/talk entities :ego "Maybe my stuff is in here...") - (actions/play-animation entities :ego :reach) - (actions/talk entities :ego "It's locked tight!")) + :script (actions/get-script entities (explore-chest entities)) :scripts {:sword (actions/get-script entities (actions/talk entities :ego "There's not enough room to swing my sword here.")) :crowbar (actions/get-script entities - (actions/talk entities :ego "Let's see if this can open this puppy up.") - (actions/walk-straight-to entities :ego [152 95] :face :right) - (actions/play-animation entities :ego :crowbar) - )}}} + (bust-chest entities))}}} :layers [(assoc (texture "inside-stash/background.png") :x 0 :y 0 :baseline 0)] - :entities {} + :entities {:lid (assoc (texture "inside-stash/lid.png") + :x 156 :y 116 :baseline 125)} :collision "inside-stash/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) - :start-pos [143 96])) + :start-pos [143 96] + :apply-state (fn [entities] + (if (get-in entities [:state :broke-lock?]) + (update-in entities [:room :entities] #(dissoc % :lid)) + entities))))