some nice refinements.

This commit is contained in:
2015-04-22 19:57:17 -07:00
parent 9a6dafef41
commit 166595447c
6 changed files with 33 additions and 21 deletions

View File

@@ -104,9 +104,10 @@
target-zoom)
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])))
(if (and (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])))
(not (get-in entities [:cam :paused?])))
(-> entities
(assoc-in [:tweens :cam-zoom]
(tween/tween :cam-zoom screen
@@ -625,10 +626,14 @@
(assoc-in e [:room :entities :ego] ego)
(assoc-in e [:state :last-room] new-background)
(assoc-in e [:tweens :fade-in] (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 time))
(update-in e [:tweens] dissoc :cam-zoom :cam-x :cam-y)
(assoc-in e [:cam :x] 160)
(assoc-in e [:cam :y] 120)
(assoc-in e [:cam :zoom] 0.95)
(if-not (get-in entities [:cam :paused?])
(-> e
(update-in [:tweens] dissoc :cam-zoom :cam-x :cam-y)
(assoc-in [:cam :x] 160)
(assoc-in [:cam :y] 120)
(assoc-in [:cam :zoom] 0.95))
e)
(if music-changed?
(assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 time))
e))