performance enhancement.

This commit is contained in:
=
2014-09-12 17:54:41 -07:00
parent da0042671e
commit aa5cb1f2f7
2 changed files with 11 additions and 6 deletions

View File

@@ -66,9 +66,12 @@
;; function for an action
(let [initial-time (atom nil)]
(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 (scale-fn target-y)
height (* scale 36)
@@ -80,8 +83,9 @@
(run! dialogue/talking-screen :stop-talk :target-id target-id)
(update-in entities [target-id :actions] rest))
(do
(run! dialogue/talking-screen :on-talk :text text
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) height)
:target-id target-id
:scale scale)
(when begin?
(run! dialogue/talking-screen :on-talk :text text
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) height)
:target-id target-id
:scale scale))
(assoc-in entities [target-id :anim] (get-in entities [target-id :talk]))))))))

View File

@@ -65,6 +65,7 @@
(conj path (from-scale current-node))
(came-from (vec current-node))))))))
(def d2 ^double (- (Math/sqrt 2) 2))
(defn heuristic ^long [^long goal-x ^long goal-y ^long current-x ^long current-y]
(let [dist-x (if (< goal-x current-x)