Page 1 of 1

[solved]Make music continue on main menu when the game ends

Posted: Thu Nov 19, 2020 7:47 pm
by WillandBran
Hello !!

I want to have a music keep going in the main menu when the game ends.
As in, the music at the end of my visual novel is the same as the main_menu music.
But, right now when it ends, the music just start over from the beginning, where I would like it to just seemlessly keep playing as the transition happen.

Right now, to display the music on the main_menu, I use this code :

on "show" action Play("music", "gui/pres_de_toi.ogg")

Re: Make music continue on main menu when the game ends

Posted: Thu Nov 19, 2020 9:43 pm
by Vladya
Pass to "Play" class the argument if_changed with the value True.

Code: Select all

on "show" action Play("music", "gui/pres_de_toi.ogg", if_changed=True)
https://www.renpy.org/doc/html/audio.ht ... music.play

Re: Make music continue on main menu when the game ends

Posted: Fri Nov 20, 2020 9:22 am
by WillandBran
Thanks for your response!
Unfortunately, I tried using this code... but it didn't work T.T

Re: Make music continue on main menu when the game ends

Posted: Fri Nov 20, 2020 10:09 am
by Vladya
Hmm... Have you performed any manipulations with config.main_menu_music variable?
If it is not set, Ren'Py will automatically call renpy.music.stop before initializing the menu.

If all you want is for the music to continue playing, set your song to config.main_menu_music and remove the Play() line at all. Behavior with a preset if_changed for config.main_menu_music is defined by default by the engine.

Re: Make music continue on main menu when the game ends

Posted: Fri Nov 20, 2020 10:26 am
by WillandBran
Ho !! It's working !!
Thanks a lot !