Basically, I've got my game set up so that starting the game enters a chapter select screen. This chapter select screen is shown inside gameplay, but is set up in such a way that it fools the player into thinking theyre still within the main menu. (This is for two reasons: one, so that I can show game progress on the chapter select screen without having to use persistent data, and two, so that when a player leaves a chapter I can have it take them back to the chapter select screen instead of the main menu.)
The problem arises with my main menu music. I want the main menu music to continue playing on the chapter select screen, but I also want to prevent the music played inside the chapter gameplay from continuing to play on the chapter select menu when the player leaves back to the chapter select menu. To do this, I figured it would be a good idea to, on the chapter select menu label, use if_changed with the play statement, like so:
Code: Select all
label chaptermenu:
play music "mainmenu.wav" if_changed
scene black
call screen chapterselect
return
I thought I'd try using an if statement with renpy.music.get_playing() but it seems that the value of renpy.music.get_playing() is None when I'm on the main menu. Which confuses me—I'm not sure why the main menu music wouldn't be using the music channel.
Nonetheless I tried something like this:
Code: Select all
label chaptermenu:
if renpy.music.get_playing() is not None:
play music "mainmenu.wav" if_changed
scene black
call screen chapterselect
return
Is there any way to fix this?