blob: 51f4330dd5eb34dcbbb73baa507526e544a88a68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}
|