performance enhancement.
This commit is contained in:
@@ -66,9 +66,12 @@
|
|||||||
;; function for an action
|
;; function for an action
|
||||||
(let [initial-time (atom nil)]
|
(let [initial-time (atom nil)]
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(swap! initial-time #(or % (:total-time screen)))
|
|
||||||
|
|
||||||
(let [target-y (get-in entities [target-id :y])
|
|
||||||
|
(let [
|
||||||
|
begin? (not@initial-time)
|
||||||
|
_ (swap! initial-time #(or % (:total-time screen)))
|
||||||
|
target-y (get-in entities [target-id :y])
|
||||||
scale-fn (get-in entities [:background :scale-fn])
|
scale-fn (get-in entities [:background :scale-fn])
|
||||||
scale (scale-fn target-y)
|
scale (scale-fn target-y)
|
||||||
height (* scale 36)
|
height (* scale 36)
|
||||||
@@ -80,8 +83,9 @@
|
|||||||
(run! dialogue/talking-screen :stop-talk :target-id target-id)
|
(run! dialogue/talking-screen :stop-talk :target-id target-id)
|
||||||
(update-in entities [target-id :actions] rest))
|
(update-in entities [target-id :actions] rest))
|
||||||
(do
|
(do
|
||||||
(run! dialogue/talking-screen :on-talk :text text
|
(when begin?
|
||||||
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) height)
|
(run! dialogue/talking-screen :on-talk :text text
|
||||||
:target-id target-id
|
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) height)
|
||||||
:scale scale)
|
:target-id target-id
|
||||||
|
:scale scale))
|
||||||
(assoc-in entities [target-id :anim] (get-in entities [target-id :talk]))))))))
|
(assoc-in entities [target-id :anim] (get-in entities [target-id :talk]))))))))
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
(conj path (from-scale current-node))
|
(conj path (from-scale current-node))
|
||||||
(came-from (vec current-node))))))))
|
(came-from (vec current-node))))))))
|
||||||
|
|
||||||
|
|
||||||
(def d2 ^double (- (Math/sqrt 2) 2))
|
(def d2 ^double (- (Math/sqrt 2) 2))
|
||||||
(defn heuristic ^long [^long goal-x ^long goal-y ^long current-x ^long current-y]
|
(defn heuristic ^long [^long goal-x ^long goal-y ^long current-x ^long current-y]
|
||||||
(let [dist-x (if (< goal-x current-x)
|
(let [dist-x (if (< goal-x current-x)
|
||||||
|
|||||||
Reference in New Issue
Block a user