diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2015-11-16 16:58:18 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2015-11-16 16:58:18 +0200 |
| commit | 13c5dc317abe0fb4458e703f2ab9397a7c24c859 (patch) | |
| tree | 1410e5e6d250cbcadc29a1b66a851473e15da8b6 /src/sound.js | |
Rengöring
Diffstat (limited to 'src/sound.js')
| -rw-r--r-- | src/sound.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sound.js b/src/sound.js new file mode 100644 index 0000000..51f4330 --- /dev/null +++ b/src/sound.js @@ -0,0 +1,20 @@ +var Sound = function() { + // start music + this.bgMusic = new Howl({ + urls: ['res/bg.mp3'], + autoplay: true, + loop: true, + volume: 1, + buffer: true + }); + + this.sounds = {jump: new Howl({ urls: ['res/jump.wav'], buffer: true }), + start: new Howl({ urls: ['res/start.wav'], buffer: true }), + explosion: new Howl({ urls: ['res/explosion.wav'], buffer: true })}; + + this.play = function(effect) { + this.sounds[effect].play() + } + + return this; +}
\ No newline at end of file |
