diff --git a/autqzs1rvq.js b/autqzs1rvq.js index dfbb79a..e2f59a4 100644 --- a/autqzs1rvq.js +++ b/autqzs1rvq.js @@ -49,6 +49,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.level = 1; this.spawnInterval = 5; this.score = 0; + this.lives = 10; this.enemies = []; @@ -638,6 +639,15 @@ this.enemies = this.enemies.reduce( */ this.kill(enemy); + if (!enemy.burning && !enemy.exploding) { + this.lives--; + console.log('lives left: ' + this.lives); + + if (this.lives < 0) { + GameLib.Event.Emit(GameLib.Event.GAME_OVER); + } + } + return result; } else {