aboutsummaryrefslogtreecommitdiffstats
path: root/src/sound.js
blob: e74b060273d509a0e73a55553cf2b19d848c291b (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;
}