Sound

Sound

Methods


add_sound(tag, volume, looping)

Parameters:
Name Type Description
tag String

the tag of the sound to add

volume Number

volume to play the sound at

looping Boolean

whether or not to loop the sound when it's played

Code Equivalent:
game.add.audio(tag, volume, looping)

get_sound_boolean_member(object, element)


Returns the chosen boolean field value of the sound.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to get values from

element

the element to get values of

Code Equivalent:
undefined

get_sound_numeric_member(object, element)


Returns the chosen numeric field value of the sound.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to get values from

element

the element to get values of

Code Equivalent:
undefined

get_sound_string_member(object, element)


Returns the chosen string field value of the sound.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to get values from

element

the element to get values of

Code Equivalent:
undefined

load_sound(tag, source)


Creates a sound with the given tag by loading it into the audio queue.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
tag String

tag to name the sound

source String

file path of the sound

Code Equivalent:
game.load.audio(tag, source);

set_sound_boolean_member(element, object, value)


Assigns the chosen boolean field for the sound.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
element

the field to set

object

sound to assign values for

value

value to set the field to

Code Equivalent:
undefined

set_sound_numeric_member(element, object, value)


Assigns the chosen numeric field for the sound.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
element

the field to set

object

sound to assign values for

value

value to set the field to

Code Equivalent:
undefined

sound_fade_in(sound_object, duration, loop)


Starts playing the sound at a volume of 0, and reaches the maximum volume for the sound over the given time, with the option to loop.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
sound_object

sound to play

duration Number

the time it takes for the sound to reach maximum volume

loop Boolean

whether or not the sound should loop

Code Equivalent:
sound_object.fadeIn(duration, loop);

sound_fade_out(sound_object, duration)


Makes the sound go from it's current volume to a volume of 0 over the given time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
sound_object

sound to stop

duration Number

the time it takes for the sound to reach 0

Code Equivalent:
sound_object.fadeOut(duration);

sound_fade_to(sound_object, duration, volume)


Makes the sound go from it's current volume to the given volume over the given time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
sound_object

sound to change

duration Number

the time it takes for the sound to reach the new volume

volume Number

the volume to change the sound to

Code Equivalent:
sound_object.fadeTo(duration, volume);

sound_loop_full(sound_object, volume)

Parameters:
Name Type Description
sound_object

sound to loop

volume Number

volume to play the sound at

Code Equivalent:
sound_object.loopFull(volume);

sound_pause(sound_object)

Parameters:
Name Type Description
sound_object

sound to pause

Code Equivalent:
sound_object.pause();

sound_play(sound_object, position, volume, loop, restart)

Parameters:
Name Type Description
sound_object

sound to play

position Number

position to play the sound from

volume Number

volume to play the sound at

loop Boolean

whether or not the sound should loop

restart Boolean

option to force the sound to restart from the beginning

Code Equivalent:
sound_object.play('', position, volume, loop, restart);

sound_restart(sound_object, position, volume, loop)

Parameters:
Name Type Description
sound_object

sound to restart

position Number

the starting position to play the sound from

volume Number

the volume to play the sound at

loop Boolean

whether or not the sound should loop

Code Equivalent:
sound_object.play('', position, volume, loop);

sound_resume(sound_object)

Parameters:
Name Type Description
sound_object

sound to resume

Code Equivalent:
sound_object.resume();

sound_stop(sound_object)

Parameters:
Name Type Description
sound_object

sound to stop

Code Equivalent:
sound_object.stop();

stop_pause_resume_sounds(option)

Parameters:
Name Type Description
option

which option to do

Code Equivalent:
game.sound.optionAll();