function SoundPool(maxSize) {
	var size = maxSize; // Max bullets allowed in the pool
	var pool = [];
	this.pool = pool;
	var currSound = 0;

	/*
	 * Populates the pool array with the given object
	 */
	this.init = function(object) {
		if (object == "laser") {
			for (var i = 0; i < size; i++) {
				// Initalize the object
				laser = new Audio("s3.wav");
				laser.volume = .12;
				laser.load();
				pool[i] = laser;
			}
		}
		else if (object == "explosion") {
			for (var i = 0; i < size; i++) {
				var explosion = new Audio("s4.wav");
				explosion.volume = .1;
				explosion.load();
				pool[i] = explosion;
			}
		}
	};

	/*
	 * Plays a sound
	 */
	this.get = function() {
		if(pool[currSound].currentTime == 0 || pool[currSound].ended) {
			pool[currSound].play();
		}
		currSound = (currSound + 1) % size;
	};
}
/**
 * A sound pool to use for the sound effects
 */
A sound pool to use for the sound effects
A sound pool to use for the sound effects
function SoundPool(maxSize) {
	var size = maxSize; 
	var pool = [];
	this.pool = pool;
	var currSound = 0;
	this.init = function(object) {
		if (object == "laser") {
			for (var i = 0; i < size; i++) {
				laser = new Audio("s3.wav");
				laser.volume = .12;
				laser.load();
				pool[i] = laser;
			}
		}
		else if (object == "explosion") {
			for (var i = 0; i < size; i++) {
				var explosion = new Audio("s4.wav");
				explosion.volume = .1;
				explosion.load();
				pool[i] = explosion;
			}
		}
	};
	this.get = function() {
		if(pool[currSound].currentTime == 0 || pool[currSound].ended) {
			pool[currSound].play();
		}
		currSound = (currSound + 1) % size;
	};
}
function SoundPool ( maxSize ) { var size = maxSize ; var pool = [ ] ; this . pool = pool ; var currSound = 0 ; this . init = function ( object ) { if ( object == "laser" ) { for ( var i = 0 ; i < size ; i ++ ) { laser = new Audio ( "s3.wav" ) ; laser . volume = .12 ; laser . load ( ) ; pool [ i ] = laser ; } } else if ( object == "explosion" ) { for ( var i = 0 ; i < size ; i ++ ) { var explosion = new Audio ( "s4.wav" ) ; explosion . volume = .1 ; explosion . load ( ) ; pool [ i ] = explosion ; } } } ; this . get = function ( ) { if ( pool [ currSound ] . currentTime == 0 || pool [ currSound ] . ended ) { pool [ currSound ] . play ( ) ; } currSound = ( currSound + 1 ) % size ; } ; }
A sound pool to use for the sound effects
A sound pool to use for the sound effects
// Max bullets allowed in the pool
 /*
	 * Populates the pool array with the given object
	 */ // Initalize the object
 /*
	 * Plays a sound
	 */