diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 48e29208..dd94e050 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -569,7 +569,7 @@ false)))) -(defn transition-background [entities new-background [x y] & {:keys [transition-music?]}] +(defn transition-background [entities new-background [x y] & {:keys [transition-music? between]}] (let [transition-music? (if (nil? transition-music?) true transition-music?) 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])) @@ -604,17 +604,18 @@ (let [ego (get-in entities [:room :entities :ego]) old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time])) entities (as-> entities e - (assoc-in e [:room] (get-in entities [:rooms new-background])) - (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 0.5)) - (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 music-changed? - (assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 0.5)) - e)) + (if between (between screen e) e) + (assoc-in e [:room] (get-in entities [:rooms new-background])) + (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 0.5)) + (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 music-changed? + (assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 0.5)) + e)) new-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time])) apply-state (get-in entities [:room :apply-state]) entities (if apply-state diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 40973c64..c70d31cc 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -304,7 +304,8 @@ :layers {:day [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)] :night [(assoc (texture "inside-castle/background-dark.png") :x 0 :y 0 :baseline 0)] - :sunrise [(assoc (texture "inside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]} + :sunrise [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0) + (assoc (texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)]} :blackout (assoc (texture "black.png") :x 0 :y 0 :width 320 diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index a66af65e..259a1215 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -292,7 +292,7 @@ (actions/give entities :carrot))))}} :layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)] :night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)] - :sunrise [(assoc (texture "outside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]} + :sunrise [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]} :entities {:peddler (actions/start-animation screen (assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil :anim-sound-frames {peddler-stand {23 [:scratch 1.0]} diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 4cd25569..ba51a852 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -14,10 +14,21 @@ [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) + + +(defn dawn-fade [screen entities] + (as-> entities entities + (assoc-in entities + [:tweens :dawn-fade] + (tween/tween :dawn-fade screen [:dawn :opacity] 1.0 0.0 12.5)) + (assoc-in entities + [:dawn :opacity] + 1.0))) + (defn walk-to-castle [entities] (actions/walk-to entities :ego [0 80]) (actions/walk-straight-to entities :ego [-20 80]) - (actions/transition-background entities :outside-castle [330 80]) + (actions/transition-background entities :outside-castle [330 80] :between dawn-fade) (actions/walk-straight-to entities :ego [310 80])) (def ego-sheep-loc @@ -405,7 +416,8 @@ :scale-x (scaler [10 163]) :scale-y (scaler [10 163]) :script (actions/get-script entities - (actions/talk entities :ego "Aww, it's a newborn lamb!")) + (actions/talk entities :ego "Aww, it's a newborn lamb!") + ) :scripts {:carrot (actions/get-script entities (actions/talk entities :ego "I think it's still nursing.")) :grass (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))} ) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index fbc55907..8c949f6d 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -570,6 +570,10 @@ :scale-y 20 :baseline 9500 :opacity 0.0) + :dawn (assoc (texture "dawn.png") + :x 0 :y 0 :baseline 240 + :colorize? true + :opacity 0.0) :actions {:object nil :channel (chan) :current nil