added a hatch that can open.

This commit is contained in:
2015-01-07 17:22:35 -08:00
parent a624adbcad
commit c2e590939f
10 changed files with 72 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -22,12 +22,20 @@
(assoc-in entities [:room :entities :watch] (get-in entities [:room :watch]))
entities))
(defn add-rope-if-necessary [entities]
(if (and (actions/has-obtained? entities :rope)
(not (actions/has-item? entities :rope))
(get-in entities [:state :knows-about-stash?]))
(assoc-in entities [:room :entities :rope] (get-in entities [:room :rope]))
entities))
(defn make-night [entities]
(-> entities
(assoc-in [:room :entities :guard] (get-in entities [:room :guard]))
add-spear-if-necessary
add-watch-if-necessary
(assoc-in [:room :entities :stash] (get-in entities [:room :stash]))))
(assoc-in [:room :entities :stash] (get-in entities [:room :stash]))
add-rope-if-necessary))
(defn search-guard [entities]
(actions/walk-to entities :ego [121 75] :face :left)
@@ -46,14 +54,38 @@
(actions/give entities :spear)
(actions/talk entities :ego "I guess he won't need this anymore."))
(defn interact-with-lever [entities]
(cond (get-in @entities [:room :entities :rope])
(do (actions/walk-to entities :ego [48 36] :face :left)
(actions/play-animation entities :ego :reach)
(actions/give entities :rope)
(actions/remove-entity entities :rope))
(get-in @entities [:state :knows-about-stash?])
(do
(actions/walk-to entities :ego [48 36] :face :left)
(actions/play-animation entities :ego :reach-start :stop? false)
(actions/play-animation entities :stash :open :stop? false)
(Thread/sleep 500)
(actions/play-animation entities :ego :reach-stop :stop? false)
(actions/play-animation entities :stash :close :stop? false)
(actions/talk entities :ego "That trapdoor closes as soon as I let the lever go!"))))
(defn try-to-go-in-stash [entities]
(when (get-in @entities [:room :entities :rope])
(actions/walk-to entities :ego [167 100] :face :right)
(actions/talk entities :ego "Here goes nothing!")
(actions/play-animation entities :ego :squat)
(actions/play-animation entities :stash :open :stop? false)
(actions/walk-straight-to entities :ego [212 97])))
(defn make [screen]
(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)))
guard-sleep (utils/make-anim "outside-jail/guard-sleep.png" [43 67] 0.1 (range 4))
open-stash (animation 0.1 [(texture "outside-jail/closed-stash.png") (texture "outside-jail/open-stash.png")])
close-stash (animation 0.1 [(texture "outside-jail/open-stash.png") (texture "outside-jail/closed-stash.png")])]
open-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (reverse (range 5)))
close-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (range 5))]
(rooms/make :music {:day :town-1 :night :night}
:interactions {:down-dir {:box [30 0 227 20]
:script (actions/get-script entities
@@ -113,14 +145,15 @@
(actions/give entities :broken-watch)))}}
:lever {:box [10 72 17 85]
:script (actions/get-script entities
(when (get-in @entities [:state :knows-about-stash?])
(actions/walk-to entities :ego [48 36] :face :left)
(actions/play-animation entities :ego :reach-start :stop? false)
(actions/play-animation entities :stash :open :stop? false)
(Thread/sleep 500)
(actions/play-animation entities :ego :reach-stop :stop? false)
(actions/play-animation entities :stash :close :stop? false)
(actions/talk entities :ego "That trapdoor closes as soon as I let the lever go!")))}}
(interact-with-lever entities))
:scripts {:rope (actions/get-script entities
(when (get-in @entities [:state :knows-about-stash?])
(actions/walk-to entities :ego [48 36] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :rope)
(actions/add-entity entities :rope (get-in @entities [:room :rope]))))}}
:end-of-rope {:box [177 101 185 108]
:script (actions/get-script entities (try-to-go-in-stash entities))}}
:layers {:day [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)]
:night [(assoc (texture "outside-jail/background-dark.png") :x 0 :y 0 :baseline 0)]}
:entities {:fountain (assoc (animation->texture screen fountain)
@@ -151,6 +184,8 @@
:talk guard-talk
:sleep guard-sleep
:script (actions/get-script entities (search-guard entities))))
:rope (rooms/make-entity :rope (assoc (texture "outside-jail/rope.png")
:x 14 :y 20 :baseline 1))
:spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png")
:x 60 :y 65 :baseline 180
:script (actions/get-script entities (grab-spear entities))))