From 9e42b648ef61cc62e9b60aa2193c3725a2e8902e Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 24 Nov 2017 15:59:42 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (a2ow5l92js.js) 573 bytes modified --- a2ow5l92js.js | 92 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/a2ow5l92js.js b/a2ow5l92js.js index af3b7e3..2869231 100644 --- a/a2ow5l92js.js +++ b/a2ow5l92js.js @@ -43,6 +43,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.burger.instance.visible = false; this.parcel.instance.visible = false; this.santa.instance.visible = false; + this.kanister.instance.visible = false; this.treesBurning = 0; this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3); @@ -196,30 +197,19 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { ); }; - this.spawnKanister = function() { - console.log('spawning kanister'); - - this.setNextKanisterSpawnScore(); - - GameLib.Event.Emit( - GameLib.Event.GAME_DATA, - { - event : 'kanisterCountUpdate', - kanisters : this.kanisters - } - ); - }; - - this.spawnEnemy = function() { - - this.enemiesSpawned++; - - this.setLevelProperties(); + this.spawnEnemy = function(kanister) { var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5); var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5); + if (kanister) { + meshType = 6; + } else { + this.enemiesSpawned++; + this.setLevelProperties(); + } + var y = GameLib.Utils.GetRandomIntInclusive(2, 10); var speed = 1; @@ -253,7 +243,13 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { score = 100; material = this.santa.materials[0].clone(); speed = 0.6; - } else { + } else if (meshType === 6) { + mesh = this.kanister.clone(); + score = 100; + material = this.kanister.materials[0].clone(); + speed = 0.7; + } + else { console.log('unknown mesh type : ' + meshType); } @@ -347,18 +343,41 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy.meshType = meshType; enemy.score = score; - GameLib.Event.Emit( - GameLib.Event.GAME_DATA, - { - enemiesSpawned : this.enemiesSpawned, - enemy : enemy, - event : 'enemySpawned' - } - ); + if (kanister) { + + } else { + + GameLib.Event.Emit( + GameLib.Event.GAME_DATA, + { + enemiesSpawned: this.enemiesSpawned, + enemy: enemy, + event: 'enemySpawned' + } + ); + } this.enemies.push(enemy); }; + this.spawnKanister = function() { + + console.log('spawning kanister'); + + this.setNextKanisterSpawnScore(); + + GameLib.Event.Emit( + GameLib.Event.GAME_DATA, + { + event : 'kanisterCountUpdate', + kanisters : this.kanisters + } + ); + + this.spawnEnemy(true); + }; + + this.explodeMesh = function(mesh) { mesh.visible = false; @@ -460,11 +479,20 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { ); }; - this.explodeKanister = function() { + this.explodeKanister = function(mesh) { this.kanisters += 1; - this.kanisterTime = 0; + //this.kanisterTime = 0; // this.fuelFinished = false; - this.explodeMesh(this.kanister); + 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) { @@ -681,7 +709,7 @@ if (this.mouseIsDown) var mesh = intersect.mesh; if (mesh.name.indexOf('Kanister') !== -1) { - this.explodeKanister(); + this.explodeKanister(mesh); return; }