Minor improvements.
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -97,5 +97,4 @@
|
||||
(close entities)))))
|
||||
|
||||
:on-resize (fn [screen entities]
|
||||
(height! screen 960)
|
||||
entities))
|
||||
(size! screen 1280 960)))
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
(if (actions/has-item? @entities items/wool)
|
||||
(actions/talk entities :ego "The sheep has given me enough wool.")
|
||||
(if (is-sheep-close? @entities)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/give entities items/wool)
|
||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||
@@ -176,12 +176,12 @@
|
||||
:scripts {:wool (actions/get-script entities
|
||||
(actions/talk entities :ego "She doesn't need it back."))
|
||||
:carrot (actions/get-script entities
|
||||
(actions/walk-to entities :ego ego-sheep-loc)
|
||||
(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]))
|
||||
:flask-1 (actions/get-script entities
|
||||
(if (is-sheep-close? @entities)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/remove-item entities items/flask-1)
|
||||
(actions/give entities items/flask-1-with-milk)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
(def default-interaction
|
||||
{:get-script (fn [cursor [x y]] (if (= :main cursor)
|
||||
(actions/get-script entities
|
||||
(actions/walk-to entities :ego [x y] true))
|
||||
(actions/walk-to entities :ego [x y] :can-skip? true))
|
||||
(actions/get-script entities
|
||||
(actions/talk entities :ego "I don't know what to do with that."))))})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user