Update: CC - Before Render - Moorcow (080g209iov.js) 338 bytes modified

beta.r3js.org
-=yb4f310 2017-11-18 09:29:37 +01:00
parent a156579268
commit 703d529d06
1 changed files with 25 additions and 7 deletions

View File

@ -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();
}