Page 1 of 1

How do I change the music playing?

Posted: Tue Apr 05, 2022 12:30 am
by Algumber
There would be a separate theme for the menu and the game itself in a game i'm making, how do i make the menu music alternate to the gameplay music?

Re: How do I change the music playing?

Posted: Tue Apr 05, 2022 4:54 am
by CogentInvalid
You would load both audio files with love.audio.newSource, play the menu music with love.audio.play, and, when going to gameplay, stopping the menu music with love.audio.stop and using love.audio.play to play the gameplay music.

Re: How do I change the music playing?

Posted: Tue Apr 05, 2022 8:57 am
by MrFariator
Additionally, if you want a smoother transition between the menu and gameplay tracks by fading them in/out over time, you can either use love.audio.setVolume (to set the master volume), or individually set the volume for each track with Source:setVolume.