state updates screens.

This commit is contained in:
2014-11-20 18:23:30 -08:00
parent 8e54c82979
commit 64e0176e76
6 changed files with 35 additions and 7 deletions

View File

@@ -179,7 +179,10 @@
:carrot (actions/get-script entities
(actions/walk-to entities :ego ego-sheep-loc :face :left)
(actions/talk entities :ego "Come on girl, get the carrot!")
(actions/walk-straight-to entities :sheep [95 150]))
(actions/walk-straight-to entities :sheep [95 150])
(actions/play-animation entities :ego :reach)
(actions/remove-item entities items/carrot)
(actions/update-state entities #(assoc % :coaxed-sheep? true)))
:flask-1 (actions/get-script entities
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
@@ -195,4 +198,9 @@
:stand sheep-stand})
sheep-stand)}
:collision "outsidehouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00))))
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:apply-state (fn [entities]
(as-> entities entities
(if (get-in entities [:state :coaxed-sheep?])
(update-in entities [:room :entities :sheep] #(assoc % :x 95 :y 150 :baseline 40))
entities))))))