sound_isplaying

Checks to see if a given sound is playing.

Syntax:

sound_isplaying(index);


Argument Description
index The index of the sound to check for.


Returns: Boolean


Description

With this function you can check to see if an instance of the sound index is playing currently (true) or not (false). Please note that if you do this check a moment after the indexed sound is supposed to have started it may return false erroneously as the sound system has not had enough time to initialize the sound properly.


Example:

if !sound_isplaying(snd_Music)
   {
   sound_play(snd_GameOver);
   instance_create(x, y, obj_GameOver_Menu);
   }

The above code checks the sound to see if it is still playing and if it is not, it plays another sound and creates a new instance.


Back: Legacy Sound
Next: sound_volume
© Copyright YoYo Games Ltd. 2018 All Rights Reserved