Class: Sound

sound~Sound(options)

Global plugin for playing back audio from files.

Constructor

new Sound(options)

Parameters:
Name Type Description
options An options object for this plugin. Passed via the game config.
Properties
Name Type Description
key The key to use for localStorage. Used to store wether this plugin is muted or not.
Source:

Members

isOn :boolean

Wether this sound plugin is active or on (not muted).
Type:
  • boolean
Default Value:
  • true
Source:

Methods

loop(name)

Plays an audio file and keeps looping it. Does nothing if the sound is already playing.
Parameters:
Name Type Description
name string The asset name.
Source:

play(name)

Plays an audio file. Does nothing if it is already playing.
Parameters:
Name Type Description
name string The asset name.
Source:

playChunk(asset, name)

Internal function that plays a chunk.
Parameters:
Name Type Description
asset object The asset.
name string The asset name.
Source:

playDown(name)

Plays the previous chunk from the audio file. If your chunks are notes that go up, this will create a negative vibe as the notes will sound like they are going down.
Parameters:
Name Type Description
name string The asset name.
Source:

playRandom(name)

Plays a random chunk from the audio file. If no chunks are defined it will play the complete sound.
Parameters:
Name Type Description
name string The asset name.
Source:

playUp(name)

Plays the next chunk from the audio file. If your chunks are notes that go up, this will create a positive feeling.
Parameters:
Name Type Description
name string The asset name.
Source:

stop(name)

Stops an audio file that is playing.
Parameters:
Name Type Description
name string The asset name.
Source: