diff --git a/a2ow5l92js.js b/a2ow5l92js.js index 1e051ac..4b344dd 100644 --- a/a2ow5l92js.js +++ b/a2ow5l92js.js @@ -197,7 +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, + nextKanisterSpawnScore : this.kanisterSpawnScore + } + ); }; this.spawnEnemy = function() { @@ -432,7 +444,6 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { ); if (this.score > this.kanisterSpawnScore) { - this.setNextKanisterSpawnScore(); this.spawnKanister(); } @@ -650,7 +661,6 @@ this.scene.meshes.map( if (this.mouseIsDown) { - this.kanisterTime += data.delta; this.renderer.clearColor.r += 0.01; @@ -758,7 +768,7 @@ else } var used = this.kanisterTime / this.kanisterLife; - + GameLib.Event.Emit( GameLib.Event.GAME_DATA, { @@ -769,8 +779,6 @@ GameLib.Event.Emit( } ); -//console.log('used : ' + Math.round(used * 100) + '%'); - if (this.kanisterTime > this.kanisterLife) { this.kanisterTime = 0; @@ -780,10 +788,11 @@ if (this.kanisterTime > this.kanisterLife) { GameLib.Event.GAME_DATA, { event : 'kanisterCountUpdate', - kanisters : this.kanisters + kanisters : this.kanisters, + nextKanisterSpawnScore : this.kanisterSpawnScore } ); - + if (kanisters < 0) { GameLib.Event.Emit( GameLib.Event.GAME_OVER,