sound_play

Plays the specified sound effect, supports both built-in and custom sounds. Returns the id of the sound played.

Use either

asset_get( sound )  Reference→ sound_get( sound )  Reference→

to retrieve the ID.

ArgumentTypeDescription
soundID:realThe ID of the game sound to play
looping:real(optional)
Whether to loop the sound or not. If set to true, be sure to save the id of the sound so you can later stop it with sound_stop( sound ) Reference→
panning:real(optional)
The panning of the sound. Should be between -1 and 1. Using the keyword noone will use normal panning.
volume:real(optional)
The volume of the sound. Should be between 0 and 1.
pitch:real(optional)
The pitch of the sound, in multiples. 2 will play the sound at double pitch, 0.5 at half pitch, and so on.

Example, called from attack_update.gml:

if (attack == AT_NSPECIAL) {
if (window == 4 && window_timer == 1) {
sound_play( sound_get( "custom" ) );
}
}