diff --git a/desktop/in-jail.edn b/desktop/in-jail.edn index bc005f39..f6cfb14e 100644 --- a/desktop/in-jail.edn +++ b/desktop/in-jail.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy}} +{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night} diff --git a/desktop/ready-to-pull-sword.edn b/desktop/ready-to-pull-sword.edn index 9fcf219f..6ba3502a 100644 --- a/desktop/ready-to-pull-sword.edn +++ b/desktop/ready-to-pull-sword.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :inventory [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy}} +{:active? true, :convinced-wizard? true, :inventory [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day} diff --git a/desktop/src-common/advent/screens/rooms/common.clj b/desktop/src-common/advent/screens/rooms/common.clj index 5fb843c4..e43d4c12 100644 --- a/desktop/src-common/advent/screens/rooms/common.clj +++ b/desktop/src-common/advent/screens/rooms/common.clj @@ -12,6 +12,7 @@ [play-clj.g2d :refer :all])) (defn go-to-jail [entities] + (actions/update-state entities #(assoc % :time :night)) (actions/update-state entities #(assoc % :chest-contents (concat (remove #{:key} (:inventory %)) (:chest-contents %)))) (actions/update-state entities #(assoc % :inventory [])) (actions/update-state entities #(assoc % :opened-bars? false)) diff --git a/desktop/src-common/advent/screens/rooms/inside_jail.clj b/desktop/src-common/advent/screens/rooms/inside_jail.clj index 34dcf455..ebbf1164 100644 --- a/desktop/src-common/advent/screens/rooms/inside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/inside_jail.clj @@ -149,6 +149,22 @@ (actions/update-state entities #(assoc % :hay-searches (inc hay-searches))))) +(defn leave [entities] + (if (get-in @entities [:state :opened-bars?]) + (do + (actions/walk-to entities :ego [279 57]) + (if (chest-full? entities) + (actions/talk entities :ego "I probably shouldn't leave without my belongings.") + (do (actions/transition-background entities :outside-jail [50 46] ) + (when (not (get-in @entities [:state :dropped-ball?])) + (actions/do-dialogue entities :ego "Yes I made it!" + :guard "Hmm?" + :guard "Halt! Thou art under arrest!" + :guard "Thou wilst be putteth back into thy cell.") + (common/go-to-jail entities) + (actions/do-dialogue entities :ego "Dang! I was so close to freedom, I could taste it!"))))) + (actions/talk entities :ego "Do you really think I can walk down those steps while I'm locked up?"))) + (defn make [screen] @@ -183,14 +199,7 @@ :script (actions/get-script entities (touch-chest entities))} :door {:box [257 62 301 152] :cursor :down - :script (actions/get-script entities - (if (get-in @entities [:state :opened-bars?]) - (do - (actions/walk-to entities :ego [279 57]) - (if (chest-full? entities) - (actions/talk entities :ego "I probably shouldn't leave without my belongings.") - (actions/transition-background entities :outside-jail [50 46] ))) - (actions/talk entities :ego "Do you really think I can walk down those steps while I'm locked up?")))}} + :script (actions/get-script entities (leave entities))}} :layers [(assoc (texture "inside-jail/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "inside-jail/bars.png") :x 0 :y 0 :baseline 165) (assoc (texture "inside-jail/glow.png") :x 0 :y 0 :baseline 240)] diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index 45932026..0da4eecf 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -11,7 +11,10 @@ (defn make [screen] - (let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3))] + (let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3)) + guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87) + guard-stand (animation 0.1 [(aget guard-sheet 0 0)]) + guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i)))] (rooms/make :music :town-2 :interactions {:down-dir {:box [30 0 227 20] :script (actions/get-script entities @@ -66,6 +69,13 @@ :width 10 :height 10 :talk-color (color 0.9 0.3 0.9 1.0)}} + :guard (assoc (animation->texture screen guard-stand) + :x 70 :y 55 :baseline 185) :collision "outside-jail/collision.png" :scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3) - :start-pos [145 15]))) + :start-pos [145 15] + :apply-state (fn [entities] + (as-> entities entities + (if (= :night (get-in entities [:state :time])) + (assoc-in entities [:room :entities :guard] (get-in entities [:room :guard])) + entities))))))