Update: CC - Before Render - Moorcow (a2ow5l92js.js) 172 bytes modified

beta.r3js.org
-=yb4f310 2017-11-24 15:39:14 +01:00
parent 865661bd99
commit 86af9dcc28
1 changed files with 16 additions and 7 deletions

View File

@ -197,7 +197,19 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
}; };
this.spawnKanister = function() { this.spawnKanister = function() {
console.log('spawning kanister'); console.log('spawning kanister');
this.setNextKanisterSpawnScore();
GameLib.Event.Emit(
GameLib.Event.GAME_DATA,
{
event : 'kanisterCountUpdate',
kanisters : this.kanisters,
nextKanisterSpawnScore : this.kanisterSpawnScore
}
);
}; };
this.spawnEnemy = function() { this.spawnEnemy = function() {
@ -432,7 +444,6 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
); );
if (this.score > this.kanisterSpawnScore) { if (this.score > this.kanisterSpawnScore) {
this.setNextKanisterSpawnScore();
this.spawnKanister(); this.spawnKanister();
} }
@ -650,7 +661,6 @@ this.scene.meshes.map(
if (this.mouseIsDown) if (this.mouseIsDown)
{ {
this.kanisterTime += data.delta; this.kanisterTime += data.delta;
this.renderer.clearColor.r += 0.01; this.renderer.clearColor.r += 0.01;
@ -758,7 +768,7 @@ else
} }
var used = this.kanisterTime / this.kanisterLife; var used = this.kanisterTime / this.kanisterLife;
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GAME_DATA, GameLib.Event.GAME_DATA,
{ {
@ -769,8 +779,6 @@ GameLib.Event.Emit(
} }
); );
//console.log('used : ' + Math.round(used * 100) + '%');
if (this.kanisterTime > this.kanisterLife) { if (this.kanisterTime > this.kanisterLife) {
this.kanisterTime = 0; this.kanisterTime = 0;
@ -780,10 +788,11 @@ if (this.kanisterTime > this.kanisterLife) {
GameLib.Event.GAME_DATA, GameLib.Event.GAME_DATA,
{ {
event : 'kanisterCountUpdate', event : 'kanisterCountUpdate',
kanisters : this.kanisters kanisters : this.kanisters,
nextKanisterSpawnScore : this.kanisterSpawnScore
} }
); );
if (kanisters < 0) { if (kanisters < 0) {
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GAME_OVER, GameLib.Event.GAME_OVER,