Solarus Forum

Solarus => Development => Topic started by: ChampionLeake on June 09, 2018, 09:18:31 pm

Title: Music transitions (Fading in/out)
Post by: ChampionLeake on June 09, 2018, 09:18:31 pm
I currently trying to explore a way to make the bgm fade in/out when I'm switching in a transition from a map to a new area. As the screen fades out (as a transition), I want the music to slowly fade out as well. Same thing when I'm entering a new map where I want the  bgm to fade in.

Is there a way to get started with that? I've been looking around for some scripts.
Title: Re: Music transitions (Fading in/out)
Post by: Diarandor on June 09, 2018, 11:39:29 pm
Exercise: code it yourself. (Hint: use timers to change the volume in a smooth way.)
Title: Re: Music transitions (Fading in/out)
Post by: Max on June 10, 2018, 01:45:43 am
You should probably know before you try coding though, I don't think Solarus has two tracks for music, so crossfading would (as far as I can tell) be impossible, since playing a new track automatically overwrites the current track. I'd recommend a quicker fade so there isn't much silence. Or embrace the silence and compose tracks like Breath of the Wild's.
Title: Re: Music transitions (Fading in/out)
Post by: Max on June 18, 2018, 08:01:23 pm
Something else I thought of- there's a few games I've played (Metroid, Hollow Knight) that when transitioning between areas, have a room with no music. The rooms also visually transition between the spaces, and you could use map:on_started() in the transition room to get the music that was playing from a savegame variable, and fade it out, then in the first room of each area use map:on_opening_transition_finished to fade in music that you start silently on map:on_started.