transition works.
This commit is contained in:
@@ -569,19 +569,20 @@
|
|||||||
false))))
|
false))))
|
||||||
|
|
||||||
|
|
||||||
(defn transition-background [entities new-background [x y] & {:keys [transition-music? between]}]
|
(defn transition-background [entities new-background [x y] & {:keys [transition-music? between time]}]
|
||||||
(let [transition-music? (if (nil? transition-music?) true transition-music?)
|
(let [transition-music? (if (nil? transition-music?) true transition-music?)
|
||||||
old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
|
old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
|
||||||
new-music (get-music (get-in @entities [:rooms new-background :music]) (get-in @entities [:state :time]))
|
new-music (get-music (get-in @entities [:rooms new-background :music]) (get-in @entities [:state :time]))
|
||||||
music-changed? (and transition-music? (not= old-music new-music))]
|
music-changed? (and transition-music? (not= old-music new-music))
|
||||||
|
time (/ (float (or time 1.0)) 2.0)]
|
||||||
(run-action entities
|
(run-action entities
|
||||||
(begin [this screen entities]
|
(begin [this screen entities]
|
||||||
(doseq [[k] (get-in entities [:room :timers])]
|
(doseq [[k] (get-in entities [:room :timers])]
|
||||||
(remove-timer! screen k))
|
(remove-timer! screen k))
|
||||||
(as-> entities e
|
(as-> entities e
|
||||||
(assoc-in e [:tweens :fade-out] (tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 0.5))
|
(assoc-in e [:tweens :fade-out] (tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 time))
|
||||||
(if music-changed?
|
(if music-changed?
|
||||||
(assoc-in e [:tweens :fade-out-music] (tween/tween :fade-out-music screen [:volume :value] 1.0 0.0 0.5))
|
(assoc-in e [:tweens :fade-out-music] (tween/tween :fade-out-music screen [:volume :value] 1.0 0.0 time))
|
||||||
e)
|
e)
|
||||||
(assoc-in e [:cursor :current] :main)))
|
(assoc-in e [:cursor :current] :main)))
|
||||||
|
|
||||||
@@ -608,13 +609,13 @@
|
|||||||
(assoc-in e [:room] (get-in entities [:rooms new-background]))
|
(assoc-in e [:room] (get-in entities [:rooms new-background]))
|
||||||
(assoc-in e [:room :entities :ego] ego)
|
(assoc-in e [:room :entities :ego] ego)
|
||||||
(assoc-in e [:state :last-room] new-background)
|
(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 0.5))
|
(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)
|
(update-in e [:tweens] dissoc :cam-zoom :cam-x :cam-y)
|
||||||
(assoc-in e [:cam :x] 160)
|
(assoc-in e [:cam :x] 160)
|
||||||
(assoc-in e [:cam :y] 120)
|
(assoc-in e [:cam :y] 120)
|
||||||
(assoc-in e [:cam :zoom] 0.95)
|
(assoc-in e [:cam :zoom] 0.95)
|
||||||
(if music-changed?
|
(if music-changed?
|
||||||
(assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 0.5))
|
(assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 time))
|
||||||
e))
|
e))
|
||||||
new-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
|
new-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
|
||||||
apply-state (get-in entities [:room :apply-state])
|
apply-state (get-in entities [:room :apply-state])
|
||||||
|
|||||||
@@ -275,7 +275,16 @@
|
|||||||
(actions/do-dialogue entities :ego "Yes! Now, before he gets back!")
|
(actions/do-dialogue entities :ego "Yes! Now, before he gets back!")
|
||||||
(actions/pause-camera entities)
|
(actions/pause-camera entities)
|
||||||
(actions/walk-straight-to entities :ego [173 51] :anim :jump :update-baseline? false :speed 2.0)
|
(actions/walk-straight-to entities :ego [173 51] :anim :jump :update-baseline? false :speed 2.0)
|
||||||
(actions/walk-straight-to entities :ego [204 -40] :anim :stand :update-baseline? false :speed 3.0))
|
(actions/walk-straight-to entities :ego [200 -80] :anim :stand :update-baseline? false :speed 3.0)
|
||||||
|
(actions/remove-item entities :dream-sword)
|
||||||
|
(actions/remove-item entities :broom)
|
||||||
|
(actions/remove-item entities :shovel)
|
||||||
|
(actions/transition-background entities :inside-castle [79 145] :time 5.0)
|
||||||
|
(actions/walk-to entities :ego [159 74])
|
||||||
|
(actions/do-dialogue entities
|
||||||
|
:ego "Man! What a dream!"
|
||||||
|
:ego "If I only really could be a knight."
|
||||||
|
:ego "Then I'd be able to win Georgia McGorgeous' heart."))
|
||||||
(do (actions/walk-to entities :ego [148 76] :face :right)
|
(do (actions/walk-to entities :ego [148 76] :face :right)
|
||||||
(actions/do-dialogue entities
|
(actions/do-dialogue entities
|
||||||
:fairy-godfather "What are you doing?" :ego "Erm... Nothing."))))})
|
:fairy-godfather "What are you doing?" :ego "Erm... Nothing."))))})
|
||||||
|
|||||||
Reference in New Issue
Block a user