game.js
// Checks for dead enemies and removes them
Checks for dead enemies and removes them
Checks for dead enemies and removes them
function removeDeadEnemies(enemies) {
	var i = 0;
	while(i<enemies.length) {
		if (!enemies) {
			break;
		}
		if (enemies[i].health <= 0) {
			updateOutput(enemies[i].name + " was defeated! " + player.name + " gained " + enemies[i].expYield + " EXP!");
			player.experience += enemies[i].expYield;
			if (player.experience >= player.expNextLevel) {
				player.levelUp();
			}
			gameScene.removeChild(enemies[i].spr);
			enemies.splice(i,1);
		} else {
			i++;
		}
	}
}
function removeDeadEnemies ( enemies ) { var i = 0 ; while ( i < enemies . length ) { if ( ! enemies ) { break ; } if ( enemies [ i ] . health <= 0 ) { updateOutput ( enemies [ i ] . name + " was defeated! " + player . name + " gained " + enemies [ i ] . expYield + " EXP!" ) ; player . experience += enemies [ i ] . expYield ; if ( player . experience >= player . expNextLevel ) { player . levelUp ( ) ; } gameScene . removeChild ( enemies [ i ] . spr ) ; enemies . splice ( i , 1 ) ; } else { i ++ ; } } }
Checks for dead enemies and removes them
Checks for dead enemies and removes them