Minor improvements.

This commit is contained in:
2014-11-02 07:31:29 -08:00
parent efd5a196e0
commit 862dfc158e
4 changed files with 9 additions and 10 deletions

View File

@@ -55,8 +55,8 @@
:anim-start (:total-time screen))
entity)))
(defn stop [screen entities target-id]
(update-in entities [:room :entities target-id] #(start-animation screen % :stand)))
(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))))
(defmacro run-action [entities & forms]
@@ -139,7 +139,7 @@
(terminate [this screen entities] entities)
(can-skip? [this screen entities] false)))
(defn walk-to [entities target-id [final-x final-y] & [can-skip?]]
(defn walk-to [entities target-id [final-x final-y] & {:keys [can-skip? face]}]
(let [{start-x :x start-y :y} (get-in @entities [:room :entities target-id])
final-x (int final-x)
final-y (int final-y)
@@ -188,7 +188,7 @@
(< (utils/dist final-x final-y from-x from-y) 1)))
(terminate [this screen entities]
(stop screen entities target-id))
(stop screen entities target-id :face face))
(can-skip? [this screen entities]
(or can-skip? false)))
@entities)))