more of the escape put into place.
This commit is contained in:
BIN
desktop/resources/inside-jail/collision-free.png
Normal file
BIN
desktop/resources/inside-jail/collision-free.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
desktop/resources/inside-jail/collision-locked.png
Normal file
BIN
desktop/resources/inside-jail/collision-locked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
desktop/resources/inside-jail/moveable-bars.png
Normal file
BIN
desktop/resources/inside-jail/moveable-bars.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -3,11 +3,42 @@
|
||||
[advent.actions :as actions]
|
||||
[advent.screens.items :as items]
|
||||
[advent.utils :as utils]
|
||||
[advent.pathfind]
|
||||
[clojure.zip :as zip]
|
||||
[play-clj.core :refer :all]
|
||||
[play-clj.ui :refer :all]
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]))
|
||||
(defn remove-lock [entities]
|
||||
(-> entities
|
||||
(update-in [:room :interactions]
|
||||
(fn [i] (remove #(= :lock (:id %)) i)))
|
||||
(assoc-in [:room :collision] (get-in entities [:room :collision-free]))))
|
||||
|
||||
(defn open-lock [entities]
|
||||
(actions/walk-to entities :ego [174 80] :face :right)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/talk entities :ego "Yes, that's it!")
|
||||
(actions/walk-straight-to entities :moveable-bars [60 77])
|
||||
(actions/update-entities entities #(remove-lock %))
|
||||
(actions/update-state entities #(assoc % :opened-bars? true)))
|
||||
|
||||
(defn touch-chest [entities]
|
||||
(if (get-in @entities [:state :opened-bars?])
|
||||
(do (actions/walk-to entities :ego [192 66] :face :right)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/do-dialogue entities
|
||||
:ego "Hey!"
|
||||
:ego "All my possessions are in here!")
|
||||
(when (not (actions/has-obtained? entities :rope))
|
||||
(actions/do-dialogue entities :ego "Looks like there's some rope in here too.")))
|
||||
|
||||
(do (actions/walk-to entities :ego [179 81] :face :right)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/do-dialogue entities :ego "I can't reach it!")
|
||||
(when (not (get-in @entities [:state :warden-sleeping?]))
|
||||
(actions/do-dialogue entities :warden "Quit yer yappin'!"
|
||||
:warden "You're not escaping while I'm on watch, so just give it up.")))))
|
||||
|
||||
|
||||
(defn do-warden-dialogue [entities]
|
||||
@@ -90,9 +121,7 @@
|
||||
:ego "Maybe you should give it a rest.")))
|
||||
(actions/update-state entities #(assoc % :hay-searches (inc hay-searches)))))
|
||||
|
||||
(defn remove-lock [entities]
|
||||
(update-in entities [:room :interactions]
|
||||
(fn [i] (remove #(= :lock (:id %)) i))))
|
||||
|
||||
|
||||
(defn make [screen]
|
||||
(let [warden-sheet (texture! (texture "inside-jail/warden.png") :split 43 58)
|
||||
@@ -111,13 +140,7 @@
|
||||
(actions/walk-to entities :ego [174 80] :face :right)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/talk entities :ego "There's no helping it. It's locked."))
|
||||
:scripts {:key (actions/get-script entities
|
||||
(actions/walk-to entities :ego [174 80] :face :right)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/talk entities :ego "Yes, that's it!")
|
||||
(actions/walk-straight-to entities :moveable-bars [60 77])
|
||||
(actions/update-entities entities #(remove-lock %))
|
||||
(actions/update-state entities #(assoc % :opened-bars? true)))}}
|
||||
:scripts {:key (actions/get-script entities (open-lock entities))}}
|
||||
:window {:box [98 110 118 140]
|
||||
:script (actions/get-script entities
|
||||
(actions/walk-to entities :ego [102 88] :face :right)
|
||||
@@ -127,7 +150,9 @@
|
||||
:ego "I have to find a way out of here!"))}
|
||||
:hay {:box [130 86 177 102]
|
||||
:script (actions/get-script entities
|
||||
(search-hay entities))}}
|
||||
(search-hay entities))}
|
||||
:chest {:box [194 62 228 99]
|
||||
:script (actions/get-script entities (touch-chest 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)]
|
||||
@@ -161,7 +186,8 @@
|
||||
(actions/give entities :ball-n-chain)))
|
||||
:moveable-bars (assoc (texture "inside-jail/moveable-bars.png")
|
||||
:x 132 :y 77 :baseline 163)}
|
||||
:collision "inside-jail/collision.png"
|
||||
:collision "inside-jail/collision-locked.png"
|
||||
:collision-free (advent.pathfind/map-from-resource "inside-jail/collision-free.png")
|
||||
:scale-fn (utils/scaler-fn-with-baseline 0 0.50 1.5)
|
||||
:start-pos [130 85]
|
||||
:apply-state (fn [entities]
|
||||
@@ -173,5 +199,7 @@
|
||||
(update-in entities [:room :entities :warden] #(actions/start-animation % :sleep))
|
||||
entities)
|
||||
(if (get-in entities [:state :opened-bars?])
|
||||
(remove-lock entities)
|
||||
(update-in (remove-lock entities)
|
||||
[:room :entities :moveable-bars]
|
||||
#(assoc % :x 60 :y 77))
|
||||
entities))))))
|
||||
|
||||
Reference in New Issue
Block a user