aboutsummaryrefslogtreecommitdiffstats
path: root/src/sound.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.js')
-rw-r--r--src/sound.js20
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