sound_play

Plays the indicated sound once.

Syntax:

sound_play(index);


Argument Description
index The index of the sound to play.


Returns: N/A


Description

This function plays the specified sound once. If the sound to played is in *.mp3 format (ie: background music), then any other sound that is playing with the same format will be stopped as the legacy GameMaker: Studio sound system does not permit more than one *.mp3 format file to be played at a time.


Example:

if mouse_check_button_pressed(mb_left)
   {
   sound_play(snd_MB_Press);
   }

The above code checks to see if the left mouse button has been pressed and if it has, it will play the sound indexed in the variable "snd_MB_Press" once.


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