This module loads sounds and plays them in your game.
ct.sound.init(name: String[, wav: String, mp3: String, options: object])
Loads a new sound to a game's sound collection. This is usually done by editor, but you may need to load additional sounds during the playtime.
poolSizethat sets the maximum number of simultaneously played sounds, and is set to 5 by default;
musicthat is set to
falseby default. Setting it to
truedisables preloading of this file.
ct.sound.spawn(name: String[, opts: Object, cb: Function])
Spawns a new sound and plays it.
nameis the name of sound to be played;
optsis a config object that is applied to a newly created audio tag;
cbis a callback, which is called when the sound finishes playing.
This method returns
HTMLTagAudio – the created audio, or
false in case a sound wasn't created.
Returns whether or not a given sound exists in the game.