3
\$\begingroup\$

I am making a small game to sort of test the waters with Game Maker and I'm trying to have an mp3 play when the splash screen loads - and persist until the game either ends or the game starts (meaning splash, menu, options all play the background mp3).

I've created an object that isn't visible, but is present in my rooms (Menu, Splash, Options) that reads:

if (!sound_isplaying(BGM_Menu))
{
    sound_loop(BGM_Menu);
}

Which will, to my understanding, go through and check for whether or not the background music is playing, if not, start it. Well no music plays on any of the menu screens.

I figured I'd try something simple, to even just get my background music to play:

play_sound(BGM_Menu);

Nothing.

So then I decided I'd go to drag and drop since sound_loop and sound_play don't seem to want to work for me. What happens is, the BGM_Menu will start to play on my splash screen, then as soon as as it transfers over to my Menu room (from Splash) it starts to loop the same song over the one that's still currently playing from the splash screen.

I've tried to solve this issue for about an hour and figured I'd come here to see if anyone else has experienced this or knows a fix.

Thanks!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Don't use legacy sound system. Use new \$\endgroup\$
    – Dmi7ry
    Commented Oct 14, 2015 at 7:28
  • \$\begingroup\$ @Dmi7ry Answers belong in the answers section! ↓ \$\endgroup\$
    – Anko
    Commented Oct 14, 2015 at 8:55
  • \$\begingroup\$ @Anko 1) It's not the answer, 2) It's very short for an answer \$\endgroup\$
    – Dmi7ry
    Commented Oct 14, 2015 at 15:44

1 Answer 1

2
\$\begingroup\$

I found out how to do it.

First of all, I was using the wrong (outdated / legacy) functions to play audio. Once I fixed that, I removed my object and instead made some creation code in my splash screen that will play / loop the music.

audio_play_sound(BGM_Menu, 10, true);

From there, I just had to make sure it closed when I entered the first stage of the game, so in my first room's creation code I put:

audio_stop_sound(BGM_Menu); //stops music from the menu
audio_play_sound(BGM_Ambient_Level1, 128, true);

Which will stop the sound from the menu and start playing the appropriate music for the level.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .