audio_emitter_exists


描述

This function returns whether an audio emitter exists (true) or not (false). Note that if the index you search for has not been initialised previously, this function will cause an error as it is searching for non-existent indices.


语法:

audio_emitter_exists(index);


参数 描述
index The index of the emitter to check the existence of.


返回:

Boolean(布尔值)


例如:

if audio_emitter_exists(s_emit)
   {
   audio_play_sound_on(s_emit, snd_Explode, false, 1);
   }
else
   {
   s_emit = audio_emitter_create();
   audio_play_sound_on(s_emit, snd_Explode, false, 1);
   }

The above code checks to see if an emitter exists, indexed in the (previously initialised) variable "s_emit". If it does then a sound is played through it, but if it does not, it is created and then the sound is played.