audio_play_music(index, loop);
Argument | Description |
---|---|
index | The index of the music to play. |
loop | Flags the music as looping or not. |
Returns: N/A
WARNING! This function has been obsoleted and you
should use audio_play_sound and audio_stop_sound
instead.
This function can be used to start a piece of background music
playing. You can only have one piece of background playing at a
time when using this function, and starting a sound while a
previous one is playing will end the previous one directly. You can
also choose whether the sound should loop back to the beginning by
setting the loop flag to true, or only to play once by
setting it to false.
if !global.Music
{
audio_stop_music();
}
else
{
audio_play_music(snd_MusicIntro, true);
}
The above code checks the global variable "Music" and if it returns false, it will stop all background music that is currently playing, and if it returns true, it will loop the music indexed in the variable "snd_MusicIntro".