camera shake.
This commit is contained in:
@@ -880,3 +880,35 @@
|
||||
(fade-out-georgia entities)
|
||||
(do-stop entities :georgia-face)
|
||||
(transition-music entities nil :duration 1.0))))
|
||||
|
||||
|
||||
(defn do-pan [entities x y scale-fn & [ease duration]]
|
||||
(actions/run-action entities
|
||||
(begin [this screen entities]
|
||||
(pan-to screen entities x y scale-fn ease duration))
|
||||
|
||||
(continue [this screen entities]
|
||||
entities)
|
||||
|
||||
(done? [this screen entities]
|
||||
(nil? (get-in entities [:tweens :cam-y])))
|
||||
|
||||
(terminate [this screen entities]
|
||||
entities)
|
||||
(skip-type [this screen entities]
|
||||
:none)))
|
||||
|
||||
(defn camera-shake [entities length]
|
||||
(dotimes [n length]
|
||||
(actions/do-pan entities (get-in @entities [:cam :x])
|
||||
(+ (get-in @entities [:cam :y])
|
||||
5)
|
||||
(constantly (get-in @entities [:cam :zoom]))
|
||||
nil
|
||||
(* 0.01 (inc n)))
|
||||
(actions/do-pan entities (get-in @entities [:cam :x])
|
||||
(- (get-in @entities [:cam :y])
|
||||
5)
|
||||
(constantly (get-in @entities [:cam :zoom]))
|
||||
nil
|
||||
(* 0.01 (inc n)))))
|
||||
|
||||
Reference in New Issue
Block a user