D
DyingSilence
Guest
Hello.
I want my game to have music that continues to play between the rooms that use the same music. My code at the moment looks like this:
But it has two issues I'd like to have solved:
1. audio_exists() doesn't actually check if a resource index exists. Is there a function that does that?
2. The check that uses audio_is_playing() doesn't prevent the file to be played multiple times. Why?
Thanks for help in advance!
I want my game to have music that continues to play between the rooms that use the same music. My code at the moment looks like this:
Code:
if(global.level == 0)
{
(!audio_exists(snd_prelevel))
{
snd_prelevel = audio_create_stream('Depressed of Happytown.ogg');
}
if(!audio_is_playing(snd_prelevel))
{
audio_play_sound(snd_prelevel,1,1);
}
}
else
{
audio_stop_sound(snd_prelevel);
audio_destroy_stream(snd_prelevel);
}
1. audio_exists() doesn't actually check if a resource index exists. Is there a function that does that?
2. The check that uses audio_is_playing() doesn't prevent the file to be played multiple times. Why?
Thanks for help in advance!