From fb9156c0e1d775cf7fc930b0ce72eafee3d40d9e Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 24 Nov 2017 16:07:42 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (a2ow5l92js.js) 223 bytes modified --- a2ow5l92js.js | 68 +++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/a2ow5l92js.js b/a2ow5l92js.js index 2869231..a9cc02b 100644 --- a/a2ow5l92js.js +++ b/a2ow5l92js.js @@ -342,9 +342,10 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy.explodingLife = 2; enemy.meshType = meshType; enemy.score = score; + enemy.isKanister = false; if (kanister) { - + enemy.isKanister = true; } else { GameLib.Event.Emit( @@ -354,7 +355,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy: enemy, event: 'enemySpawned' } - ); + ); } this.enemies.push(enemy); @@ -447,54 +448,45 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy.exploding = true; - console.log('exploding enemy'); + if (enemy.isKanister) { + this.kanisters += 1; - this.score += enemy.score; + console.log('exploding kanister'); + } else { - console.log('score : ' + this.score); + console.log('exploding enemy'); - GameLib.Event.Emit( - GameLib.Event.GAME_DATA, - { - event : 'scoreUpdate', - score : this.score + this.score += enemy.score; + + console.log('score : ' + this.score); + + GameLib.Event.Emit( + GameLib.Event.GAME_DATA, + { + event : 'scoreUpdate', + score : this.score + } + ); + + if (this.score > this.kanisterSpawnScore) { + this.spawnKanister(); } - ); - if (this.score > this.kanisterSpawnScore) { - this.spawnKanister(); + GameLib.Event.Emit( + GameLib.Event.GAME_DATA, + { + enemy : enemy, + event : 'enemyExploded' + } + ); } - GameLib.Event.Emit( - GameLib.Event.GAME_DATA, - { - enemy : enemy, - event : 'enemyExploded' - } - ); - this.explodeMesh(mesh); } }.bind(this) ); }; - this.explodeKanister = function(mesh) { - this.kanisters += 1; - //this.kanisterTime = 0; - // this.fuelFinished = false; - this.explodeMesh(mesh); - if (mesh.explodeParticleEngine) { - if (GameLib.Utils.UndefinedOrNull(mesh.waiting)) { - mesh.waiting = true; - } else { - mesh.explodeParticleEngine.remove(); - mesh.explodeParticleEngine = null; - delete mesh.waiting; - } - } - }; - this.burn = function(mesh) { this.enemies.map( @@ -709,7 +701,7 @@ if (this.mouseIsDown) var mesh = intersect.mesh; if (mesh.name.indexOf('Kanister') !== -1) { - this.explodeKanister(mesh); + this.explode(mesh); return; }