How do I change the music playing?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Algumber
Prole
Posts: 5
Joined: Tue Mar 08, 2022 10:39 pm

How do I change the music playing?

Post 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?
this post is about stuff

(Itch.io account: https://exotic-toast.itch.io/)
User avatar
CogentInvalid
Prole
Posts: 27
Joined: Sat Dec 14, 2013 12:15 am

Re: How do I change the music playing?

Post 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.
MrFariator
Party member
Posts: 548
Joined: Wed Oct 05, 2016 11:53 am

Re: How do I change the music playing?

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests