fixing jumping.
This commit is contained in:
@@ -75,11 +75,14 @@
|
||||
distance (dist from-x from-y target-x target-y)
|
||||
moved-x (* 1.5 (/ delta-x distance))
|
||||
moved-y (* 1.5 (/ delta-y distance))]
|
||||
(when (< distance 1)
|
||||
(swap! targets-left rest))
|
||||
(update-in entities [target-id]
|
||||
#(assoc (jump-to screen entities % [(+ moved-x from-x) (+ moved-y from-y)])
|
||||
:anim (if (< delta-x 0) left right))))))
|
||||
(if (< distance 1)
|
||||
(do (swap! targets-left rest)
|
||||
entities)
|
||||
(update-in entities [target-id]
|
||||
#(assoc (jump-to screen entities % [(+ moved-x from-x) (+ moved-y from-y)])
|
||||
:anim (cond (< delta-x 0) left
|
||||
(> delta-x 0) right
|
||||
:else (:anim %))))))))
|
||||
|
||||
(done? [this screen entities]
|
||||
(let [{from-x :x from-y :y :keys [left right anim] :as target-entity} (entities target-id)]
|
||||
|
||||
Reference in New Issue
Block a user