I want to let the player choose the bg music. So here's what I did.
When the game starts, the music starts playing:
Code: Select all
default persistent.bg_music = 1
label start:
scene bg main
if persistent.bg_music == 1:
play music "audio/m1.mp3"
elif persistent.bg_music == 2:
play music "audio/m2.mp3"
...
Code: Select all
## Additional vboxes of type "radio_pref" or "check_pref" can be
## added here, to add additional creator-defined preferences.
vbox:
style_prefix "radio"
label _("BG Music")
textbutton _("Disable") action [SetField(persistent, "bg_music", 0), Stop("music")]
textbutton _("Music #1") action [SetField(persistent, "bg_music", 1), Play("music", "audio/m1.mp3", False)]
textbutton _("Music #2") action [SetField(persistent, "bg_music", 2), Play("music", "audio/m2.mp3", False)]
However, when I close the game menu, the game will restart the audio file that was initially set to play when the game started.
Why is this happening, what am I doing wrong?