game.js
// Load images to be used.
Load images to be used.
Load images to be used .
function loadImages(sources, gameStart) {
	var numImages = 0;
	var numImagesLoaded = 0;
	for(var i in sources) {
		numImages++;
	}
	for(i in sources) {
		resources[i] = new Image();
		resources[i].src = sources[i];
		resources[i].onload = function() {
			if(++numImagesLoaded >= numImages) {
				gameStart();
			}
		};
	}
}
function loadImages ( sources , gameStart ) { var numImages = 0 ; var numImagesLoaded = 0 ; for ( var i in sources ) { numImages ++ ; } for ( i in sources ) { resources [ i ] = new Image ( ) ; resources [ i ] . src = sources [ i ] ; resources [ i ] . onload = function ( ) { if ( ++ numImagesLoaded >= numImages ) { gameStart ( ) ; } } ; } }
Load images to be used.
Load images to be used .
// once all images are loaded, start the game