Update: CC - Before Render - Moorcow (a2ow5l92js.js) 616 bytes modified
parent
7e5b09f50d
commit
0baaa0249b
203
a2ow5l92js.js
203
a2ow5l92js.js
|
@ -48,10 +48,40 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
this.totalTime = 0;
|
this.totalTime = 0;
|
||||||
|
|
||||||
this.kanisters = 4;
|
this.kanisters = 4;
|
||||||
this.kanisterTime = 0;
|
//this.kanisterTime = 0;
|
||||||
this.kanisterLife = 16.344;
|
this.kanisterLife = 16.344;
|
||||||
this.kanisterLeakTime = 0.001;
|
this.kanisterLeakTime = 0.001;
|
||||||
this.kanisterSpawnInterval = 50;
|
this.kanisterSpawnScore = 50;
|
||||||
|
|
||||||
|
this.setNextKanisterSpawnScore = function() {
|
||||||
|
this.kanisterSpawnScore += 50;
|
||||||
|
|
||||||
|
if (this.kanisterSpawnScore > 150) {
|
||||||
|
this.kanisterSpawnScore += 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.kanisterSpawnScore > 300) {
|
||||||
|
this.kanisterSpawnScore += 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.kanisterSpawnScore > 500) {
|
||||||
|
this.kanisterSpawnScore += 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.kanisterSpawnScore > 600) {
|
||||||
|
this.kanisterSpawnScore += 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('next kanister spawn score: ' + this.kanisterSpawnScore);
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
event : 'nextKanisterSpawnScoreUpdate',
|
||||||
|
kanisterSpawnScore : this.kanisterSpawnScore
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
this.fuelFinished = false;
|
this.fuelFinished = false;
|
||||||
|
|
||||||
|
@ -134,6 +164,10 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.spawnKanister = function() {
|
||||||
|
console.log('spawning kanister');
|
||||||
|
};
|
||||||
|
|
||||||
this.spawnEnemy = function() {
|
this.spawnEnemy = function() {
|
||||||
|
|
||||||
this.enemiesSpawned++;
|
this.enemiesSpawned++;
|
||||||
|
@ -349,10 +383,14 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
function(enemy) {
|
function(enemy) {
|
||||||
if (enemy.mesh === mesh && !enemy.exploding) {
|
if (enemy.mesh === mesh && !enemy.exploding) {
|
||||||
|
|
||||||
|
enemy.exploding = true;
|
||||||
|
|
||||||
console.log('exploding enemy');
|
console.log('exploding enemy');
|
||||||
|
|
||||||
this.score += enemy.score;
|
this.score += enemy.score;
|
||||||
|
|
||||||
|
console.log('score : ' + this.score);
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
{
|
{
|
||||||
|
@ -361,8 +399,10 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (this.score > this.kanisterSpawnScore) {
|
||||||
enemy.exploding = true;
|
this.setNextKanisterSpawnScore();
|
||||||
|
this.spawnKanister();
|
||||||
|
}
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
|
@ -379,8 +419,9 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.explodeKanister = function() {
|
this.explodeKanister = function() {
|
||||||
this.kanisterTime = 0;
|
this.kanisters += 1;
|
||||||
this.fuelFinished = false;
|
// this.kanisterTime = 0;
|
||||||
|
// this.fuelFinished = false;
|
||||||
this.explodeMesh(this.kanister);
|
this.explodeMesh(this.kanister);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -575,45 +616,22 @@ this.scene.meshes.map(
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.mouseIsDown) {
|
if (this.mouseIsDown)
|
||||||
|
{
|
||||||
|
|
||||||
this.kanisterTime += data.delta;
|
this.kanisterTime += data.delta;
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
this.renderer.clearColor.r += 0.01;
|
||||||
GameLib.Event.GAME_DATA,
|
if (this.renderer.clearColor.r > 0.45) {
|
||||||
{
|
this.renderer.clearColor.r = 0.45;
|
||||||
used : this.kanisterTime / this.kanisterLife,
|
|
||||||
event : 'fuelUsed',
|
|
||||||
percentage : Math.round((this.kanisterTime / this.kanisterLife) * 100) + '%'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this.kanisterTime > this.kanisterLife) {
|
|
||||||
this.fuelFinished = true;
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
|
||||||
event : 'fuelFinished'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.renderer.updateInstance('clearColor');
|
||||||
|
|
||||||
if (!this.fuelFinished) {
|
this.throwerLight.intensity += 0.05;
|
||||||
|
if (this.throwerLight.intensity > 2) {
|
||||||
this.renderer.clearColor.r += 0.01;
|
this.throwerLight.intensity = 2;
|
||||||
if (this.renderer.clearColor.r > 0.45) {
|
|
||||||
this.renderer.clearColor.r = 0.45;
|
|
||||||
}
|
|
||||||
this.renderer.updateInstance('clearColor');
|
|
||||||
|
|
||||||
this.throwerLight.intensity += 0.05;
|
|
||||||
if (this.throwerLight.intensity > 2) {
|
|
||||||
this.throwerLight.intensity = 2;
|
|
||||||
}
|
|
||||||
this.throwerLight.updateInstance('intensity');
|
|
||||||
}
|
}
|
||||||
|
this.throwerLight.updateInstance('intensity');
|
||||||
|
|
||||||
var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes);
|
var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes);
|
||||||
intersects.map(
|
intersects.map(
|
||||||
|
@ -689,7 +707,10 @@ if (this.mouseIsDown) {
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.kanisterTime += (data.delta * this.kanisterLeakTime);
|
||||||
|
|
||||||
this.renderer.clearColor.r -= 0.01;
|
this.renderer.clearColor.r -= 0.01;
|
||||||
if (this.renderer.clearColor.r < this.minimumRendererRed) {
|
if (this.renderer.clearColor.r < this.minimumRendererRed) {
|
||||||
|
@ -704,34 +725,58 @@ if (this.mouseIsDown) {
|
||||||
this.throwerLight.updateInstance('intensity');
|
this.throwerLight.updateInstance('intensity');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
used : this.kanisterTime / this.kanisterLife,
|
||||||
|
event : 'fuelUsed',
|
||||||
|
percentage : Math.round((this.kanisterTime / this.kanisterLife) * 100) + '%'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.kanisterTime > this.kanisterLife) {
|
||||||
|
|
||||||
|
this.kanisterTime = 0;
|
||||||
|
this.kanisters -= 1;
|
||||||
|
|
||||||
|
if (kanisters < 0) {
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_OVER,
|
||||||
|
{
|
||||||
|
game : this
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
||||||
this.enemySpawnTime = 0;
|
this.enemySpawnTime = 0;
|
||||||
this.spawnEnemy();
|
this.spawnEnemy();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
if (this.kanister.explodeParticleEngine) {
|
// if (this.kanister.explodeParticleEngine) {
|
||||||
|
// if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) {
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) {
|
// this.kanister.waiting = true;
|
||||||
this.kanister.waiting = true;
|
// } else {
|
||||||
} else {
|
// this.kanister.explodeParticleEngine.remove();
|
||||||
this.kanister.explodeParticleEngine.remove();
|
// this.kanister.explodeParticleEngine = null;
|
||||||
this.kanister.explodeParticleEngine = null;
|
// delete this.kanister.waiting;
|
||||||
delete this.kanister.waiting;
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// if (this.kanisterTime > (this.kanisterLife / 2)) {
|
||||||
|
//
|
||||||
if (this.kanisterTime > (this.kanisterLife / 2)) {
|
// this.kanister.visible = true;
|
||||||
this.kanister.visible = true;
|
// this.kanister.updateInstance('visible');
|
||||||
this.kanister.updateInstance('visible');
|
//
|
||||||
|
// GameLib.Event.Emit(
|
||||||
GameLib.Event.Emit(
|
// GameLib.Event.GAME_DATA,
|
||||||
GameLib.Event.GAME_DATA,
|
// {
|
||||||
{
|
// event : 'kanisterAppeared'
|
||||||
event : 'kanisterAppeared'
|
// }
|
||||||
}
|
// );
|
||||||
);
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
this.enemies = this.enemies.reduce(
|
this.enemies = this.enemies.reduce(
|
||||||
function(result, enemy) {
|
function(result, enemy) {
|
||||||
|
@ -769,47 +814,19 @@ this.enemies = this.enemies.reduce(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!enemy.burning && !enemy.exploding) {
|
|
||||||
|
|
||||||
this.lives--;
|
|
||||||
|
|
||||||
console.log('lives left: ' + this.lives);
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
|
||||||
livesLeft : this.lives,
|
|
||||||
event : 'lifeLost'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this.lives < 0) {
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
|
||||||
event : 'gameOver',
|
|
||||||
gameData : this
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
GameLib.Event.Emit(GameLib.Event.GAME_OVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We only remove the things we cloned
|
* We only remove the things we cloned
|
||||||
*/
|
*/
|
||||||
this.kill(enemy);
|
this.kill(enemy);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (enemy.burning) {
|
if (enemy.burning) {
|
||||||
|
|
||||||
enemy.burnTime += data.delta;
|
enemy.burnTime += data.delta;
|
||||||
|
|
||||||
if (enemy.burnTime > enemy.burnLife) {
|
if (enemy.burnTime > enemy.burnLife) {
|
||||||
enemy.mesh.smokeParticleEngine.remove();
|
enemy.mesh.smokeParticleEngine.remove();
|
||||||
enemy.mesh.fireParticleEngine.remove();
|
enemy.mesh.fireParticleEngine.remove();
|
||||||
|
|
Loading…
Reference in New Issue