Audio Sprites are a combination of audio files and a JSON configuration.
The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
Name | Type | Description |
---|---|---|
game | Phaser.Game | Reference to the current game instance. |
key | string | Asset key for the sound. |
Is a sound set to autoplay or not?
If a sound is set to auto play, this holds the marker key of it.
JSON audio atlas object.
A reference to the currently running Game.
Asset key for the Audio Sprite.
An object containing the Phaser.Sound objects for the Audio Sprite.
Get a sound with the given name.
Name | Type | Description |
---|---|---|
marker | string | The name of sound to get. |
The sound instance.
Play a sound with the given name.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
marker | string | <optional> | The name of sound to play | |
volume | number | <optional> | 1 | Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified). |
This sound instance.
Stop a sound with the given name.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
marker | string | <optional> | '' | The name of sound to stop. If none is given it will stop all sounds in the audio sprite. |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.AudioSprite.html