better idle
This commit is contained in:
@@ -86,6 +86,11 @@
|
||||
~@forms
|
||||
(change-script-state ~entities false)))))
|
||||
|
||||
(defn bound-to-camera [x length zoom]
|
||||
(min (- length (* length 0.5 zoom ))
|
||||
(max (* length 0.5 zoom )
|
||||
x)))
|
||||
|
||||
(defn pan-to [screen entities x y scale-fn & [ease duration]]
|
||||
(let [ease (or ease tween/ease-in-out-quadratic)
|
||||
duration (or duration 3.0)
|
||||
@@ -97,12 +102,8 @@
|
||||
0.07)
|
||||
current-zoom
|
||||
target-zoom)
|
||||
target-x (min (- 320 (* 160.0 target-zoom ))
|
||||
(max (* 160.0 target-zoom )
|
||||
x))
|
||||
target-y (min (- 240 (* 120.0 target-zoom ))
|
||||
(max (* 120.0 target-zoom )
|
||||
y))]
|
||||
target-x (bound-to-camera x 320 target-zoom)
|
||||
target-y (bound-to-camera y 240 target-zoom)]
|
||||
(if (or (not= target-x (get-in entities [:cam :x]))
|
||||
(not= target-y (get-in entities [:cam :y]))
|
||||
(not= target-zoom (get-in entities [:cam :zoom])))
|
||||
|
||||
Reference in New Issue
Block a user