opening the cell.

This commit is contained in:
2014-12-27 12:52:21 -08:00
parent 51a060575c
commit 766757b2cc
2 changed files with 24 additions and 12 deletions

View File

@@ -99,13 +99,16 @@
(or (get-in entity [(:facing entity) anim])
(get entity anim))))
(defn start-animation [screen entity anim]
(let [new-anim (find-animation entity anim)]
(if (and anim (not= new-anim (:anim entity)))
(assoc entity
:anim new-anim
:anim-start (:total-time screen))
entity)))
(defn start-animation
([entity anim]
(start-animation {:total-time 0} entity anim))
([screen entity anim]
(let [new-anim (find-animation entity anim)]
(if (and anim (not= new-anim (:anim entity)))
(assoc entity
:anim new-anim
:anim-start (:total-time screen))
entity))))
(defn stop [screen entities target-id & {:keys [face]}]
(update-in entities [:room :entities target-id] (comp #(start-animation screen % :stand) (if face #(assoc % :facing face) identity))))

View File

@@ -86,7 +86,8 @@
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "You know, in some games, you have to try multiple times."
:ego "I'm beginning to feel like this isn't that game.")))
:ego "But I have a feeling each time you click on this hay, I'm going to find nothing."
:ego "Maybe you should give it a rest.")))
(actions/update-state entities #(assoc % :hay-searches (inc hay-searches)))))
(defn make [screen]
@@ -105,7 +106,11 @@
:script (actions/get-script entities
(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."))}
(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!"))}}
:window {:box [98 110 118 140]
:script (actions/get-script entities
(actions/walk-to entities :ego [102 88] :face :right)
@@ -152,6 +157,10 @@
:scale-fn (utils/scaler-fn-with-baseline 0 0.50 1.5)
:start-pos [130 85]
:apply-state (fn [entities]
(if (actions/has-item? entities :ball-n-chain)
(update-in entities [:room :entities] #(dissoc % :ball-n-chain))
entities)))))
(as-> entities entities
(if (actions/has-item? entities :ball-n-chain)
(update-in entities [:room :entities] #(dissoc % :ball-n-chain))
entities)
(if (get-in entities [:state :warden-sleeping?])
(update-in entities [:room :entities :warden] #(actions/start-animation % :sleep))
entities))))))