From 703d529d06860a1750274e8e4959ac32fe2d904a Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 18 Nov 2017 09:29:37 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (080g209iov.js) 338 bytes modified --- 080g209iov.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/080g209iov.js b/080g209iov.js index 4e62fde..4ffcc33 100644 --- a/080g209iov.js +++ b/080g209iov.js @@ -46,8 +46,14 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.kanisterLife = 16.344; this.fuelFinished = false; + this.level = 1; + this.spawnInterval = 5; + this.score = 0; + this.enemies = []; + this.enemiesSpawned = 0; + GameLib.Event.Emit( GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, null, @@ -56,17 +62,26 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { }.bind(this) ); - this.getNextSpawnTime = function() { - return GameLib.Utils.GetRandomIntInclusive( + //this.getNextSpawnTime = function() { + /*return GameLib.Utils.GetRandomIntInclusive( 1, 1 - ); - } + );*/ + //} - this.nextSpawnTime = this.getNextSpawnTime(); + //this.nextSpawnTime = this.getNextSpawnTime(); + this.setLevelProperties = function() { + this.level = Math.floor(this.enemiesSpawned / 10) + 1; + this.spawnInterval -= 1 / (this.level); + } + this.spawnEnemy = function() { + this.enemiesSpawned++; + + this.setLevelProperties(); + var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5); var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5); @@ -247,6 +262,9 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { function(enemy) { if (enemy.mesh === mesh && !enemy.exploding) { console.log('exploding enemy'); + + this.score += this.level * 100; + enemy.exploding = true; this.explodeMesh(mesh); @@ -268,6 +286,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.enemies.map( function(enemy) { if (enemy.mesh === mesh && !enemy.burning) { + this.score += this.level * 10; console.log('burning enemy ' + mesh.name); enemy.burning = true; var smokeParticleEngine = this.smokeParticleEngine.clone(); @@ -542,8 +561,7 @@ if (this.mouseIsDown) { this.throwerLight.updateInstance('instensity'); } -if (this.spawnTime > this.nextSpawnTime) { - this.nextSpawnTime = this.getNextSpawnTime(); +if (this.spawnTime > this.spawnInterval) { this.spawnTime = 0; this.spawnEnemy(); }