game.js
// Any enemies past index 4 are ignored
Any enemies past index 4 are ignored
Any enemies past index 4 are ignored
function createEnemies(types) {
	var enms = [];
	for(var i = 0; i<types.length && i<5; i++) {
		var enemy = new types[i];
		enemy.spr.anchor.x = enemy.spr.anchor.y = 0.5;
		enemy.spr.position.x = 450 - 100 * i;
		enemy.spr.position.y = Math.floor((Math.random() * 40) - 20) + 200;
		enms.push(enemy);
		gameScene.addChild(enemy.spr);
	}
	return enms;
}
function createEnemies ( types ) { var enms = [ ] ; for ( var i = 0 ; i < types . length && i < 5 ; i ++ ) { var enemy = new types [ i ] ; enemy . spr . anchor . x = enemy . spr . anchor . y = 0.5 ; enemy . spr . position . x = 450 - 100 * i ; enemy . spr . position . y = Math . floor ( ( Math . random ( ) * 40 ) - 20 ) + 200 ; enms . push ( enemy ) ; gameScene . addChild ( enemy . spr ) ; } return enms ; }
Any enemies past index 4 are ignored
Any enemies past index 4 are ignored