can't get stuck without a ladder.

This commit is contained in:
Bryce Covert
2015-08-15 23:40:21 -07:00
parent 02b955a543
commit 20a2ef3ba0

View File

@@ -38,6 +38,11 @@
(particle-effect! (get-in @entities [:room :entities :puke]) :start)
(actions/play-animation entities :owl :puke))
(defn is-standing-on-ladder [entities]
(and (not (actions/has-item? entities :kiss))
(not (actions/has-item? entities :ladder))
(actions/has-obtained? entities :ladder)))
(defn do-grandma-dialogue-with-cat [entities]
(actions/walk-to entities :ego [165 45] :face :left)
(actions/do-dialogue entities
@@ -207,7 +212,7 @@
cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])]
(aget cat-stand-sheet 0 i)))
cat-walk (animation 0.2 [(texture "cat-tree/pounce.png")])
destroy-ladder (utils/make-anim "cat-tree/destroy-ladder.png" [29 38] 0.075 (range 18))
destroy-ladder (utils/make-anim "cat-tree/destroy-ladder.png" [29 38] 0.1 (range 18))
ladder-entity (assoc (texture "inside-cafeteria/ladder.png") :x 130 :y 60 :baseline 162
:origin-x 0
:destroy-ladder destroy-ladder)
@@ -222,6 +227,13 @@
owl-puke (utils/make-anim "cat-tree/owl.png" [19 28] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])
puke (particle-effect "cat-tree/puke")]
(rooms/make :music {:day :town-2 :night :night}
:ladder ladder-entity
:blank (rooms/make-entity :blank
{:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240
:script (actions/get-script entities
(when (get-in @entities [:room :entities :ladder])
(actions/talk entities :ego "I'll get down.")
(get-down entities)))})
:interactions
{:down-dir {:box [150 0 270 20]
:script (actions/get-script entities
@@ -231,19 +243,14 @@
(actions/walk-to entities :ego [158 110] :skip-type :end))
:cursor :down}
:ladder-area {:box [134 40 265 190]
:scripts {:ladder (actions/get-unsaved-script entities
(actions/talk entities :ego "I'll just set this up.")
(actions/walk-to entities :ego [151 50] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :ladder)
(actions/add-entity entities :ladder ladder-entity)
(actions/walk-straight-to entities :ego [140 85] :face :right :update-baseline? false)
(actions/add-entity entities :blank (rooms/make-entity :blank
{:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240
:script (actions/get-script entities
(when (get-in @entities [:room :entities :ladder])
(actions/talk entities :ego "I'll get down.")
(get-down entities)))})))}}
:scripts {:ladder (actions/get-script entities
(actions/talk entities :ego "I'll just set this up.")
(actions/walk-to entities :ego [151 50] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :ladder)
(actions/add-entity entities :ladder (get-in @entities [:room :ladder]))
(actions/walk-straight-to entities :ego [140 85] :face :right :update-baseline? false)
(actions/add-entity entities :blank (get-in @entities [:room :blank])))}}
:rock {:box [62 83 101 103]
:script (actions/get-script entities
(when (and (actions/has-obtained? entities :note-1)
@@ -375,6 +382,13 @@
(if (actions/has-item? entities :kiss)
(update-in entities [:room :entities] #(dissoc % :cat))
entities)
(if (is-standing-on-ladder entities)
(-> entities
(update-in [:room :entities]
assoc :blank (get-in entities [:room :blank])
:ladder (get-in entities [:room :ladder]))
(update-in [:room :entities :ego ] assoc :x 140 :y 85))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
(utils/remove-interaction entities :rock)