Minor improvements.
This commit is contained in:
@@ -55,8 +55,8 @@
|
|||||||
:anim-start (:total-time screen))
|
:anim-start (:total-time screen))
|
||||||
entity)))
|
entity)))
|
||||||
|
|
||||||
(defn stop [screen entities target-id]
|
(defn stop [screen entities target-id & {:keys [face]}]
|
||||||
(update-in entities [:room :entities target-id] #(start-animation screen % :stand)))
|
(update-in entities [:room :entities target-id] (comp #(start-animation screen % :stand) (if face #(assoc % :facing face) identity))))
|
||||||
|
|
||||||
|
|
||||||
(defmacro run-action [entities & forms]
|
(defmacro run-action [entities & forms]
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
(terminate [this screen entities] entities)
|
(terminate [this screen entities] entities)
|
||||||
(can-skip? [this screen entities] false)))
|
(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])
|
(let [{start-x :x start-y :y} (get-in @entities [:room :entities target-id])
|
||||||
final-x (int final-x)
|
final-x (int final-x)
|
||||||
final-y (int final-y)
|
final-y (int final-y)
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
(< (utils/dist final-x final-y from-x from-y) 1)))
|
(< (utils/dist final-x final-y from-x from-y) 1)))
|
||||||
|
|
||||||
(terminate [this screen entities]
|
(terminate [this screen entities]
|
||||||
(stop screen entities target-id))
|
(stop screen entities target-id :face face))
|
||||||
(can-skip? [this screen entities]
|
(can-skip? [this screen entities]
|
||||||
(or can-skip? false)))
|
(or can-skip? false)))
|
||||||
@entities)))
|
@entities)))
|
||||||
|
|||||||
@@ -97,5 +97,4 @@
|
|||||||
(close entities)))))
|
(close entities)))))
|
||||||
|
|
||||||
:on-resize (fn [screen entities]
|
:on-resize (fn [screen entities]
|
||||||
(height! screen 960)
|
(size! screen 1280 960)))
|
||||||
entities))
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
(if (actions/has-item? @entities items/wool)
|
(if (actions/has-item? @entities items/wool)
|
||||||
(actions/talk entities :ego "The sheep has given me enough wool.")
|
(actions/talk entities :ego "The sheep has given me enough wool.")
|
||||||
(if (is-sheep-close? @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/play-animation entities :ego :reach)
|
||||||
(actions/give entities items/wool)
|
(actions/give entities items/wool)
|
||||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||||
@@ -176,12 +176,12 @@
|
|||||||
:scripts {:wool (actions/get-script entities
|
:scripts {:wool (actions/get-script entities
|
||||||
(actions/talk entities :ego "She doesn't need it back."))
|
(actions/talk entities :ego "She doesn't need it back."))
|
||||||
:carrot (actions/get-script entities
|
: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/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]))
|
||||||
:flask-1 (actions/get-script entities
|
:flask-1 (actions/get-script entities
|
||||||
(if (is-sheep-close? @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/play-animation entities :ego :reach)
|
||||||
(actions/remove-item entities items/flask-1)
|
(actions/remove-item entities items/flask-1)
|
||||||
(actions/give entities items/flask-1-with-milk)
|
(actions/give entities items/flask-1-with-milk)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
(def default-interaction
|
(def default-interaction
|
||||||
{:get-script (fn [cursor [x y]] (if (= :main cursor)
|
{:get-script (fn [cursor [x y]] (if (= :main cursor)
|
||||||
(actions/get-script entities
|
(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/get-script entities
|
||||||
(actions/talk entities :ego "I don't know what to do with that."))))})
|
(actions/talk entities :ego "I don't know what to do with that."))))})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user