Update: CC - Before Render - Moorcow (a2ow5l92js.js) 223 bytes modified
parent
e45783651c
commit
7e5b09f50d
|
@ -106,34 +106,39 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
|
|
||||||
this.level = Math.floor(this.enemiesSpawned / 10) + 1;
|
this.level = Math.floor(this.enemiesSpawned / 10) + 1;
|
||||||
|
|
||||||
if (this.prevLevel !== this.level) {
|
if (this.level === 1) {
|
||||||
|
this.enemySpawnInterval = 4;
|
||||||
var amount = 1 / this.level;
|
|
||||||
|
|
||||||
if (amount < 0.1) {
|
|
||||||
amount = 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.enemySpawnInterval -= amount;
|
|
||||||
|
|
||||||
console.log('level : ' + this.level +', spawn interval : ' + this.enemySpawnInterval);
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
|
||||||
level : this.level,
|
|
||||||
enemySpawnInterval : this.enemySpawnInterval,
|
|
||||||
event : 'levelIncrease'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.level === 2) {
|
||||||
|
this.enemySpawnInterval = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.level === 3) {
|
||||||
|
this.enemySpawnInterval = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.level > 3) {
|
||||||
|
this.enemySpawnInterval = 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('level : ' + this.level +', spawn interval : ' + this.enemySpawnInterval);
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
level : this.level,
|
||||||
|
enemySpawnInterval : this.enemySpawnInterval,
|
||||||
|
event : 'levelIncrease'
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.spawnEnemy = function() {
|
this.spawnEnemy = function() {
|
||||||
|
|
||||||
this.enemiesSpawned++;
|
this.enemiesSpawned++;
|
||||||
|
|
||||||
//this.setLevelProperties();
|
this.setLevelProperties();
|
||||||
|
|
||||||
var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
||||||
var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
||||||
|
@ -142,6 +147,8 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
|
|
||||||
var speed = 1;
|
var speed = 1;
|
||||||
|
|
||||||
|
var score = 10;
|
||||||
|
|
||||||
var material = null;
|
var material = null;
|
||||||
|
|
||||||
var mesh = null;
|
var mesh = null;
|
||||||
|
@ -151,18 +158,22 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
speed = 0.2;
|
speed = 0.2;
|
||||||
} else if (meshType === 2) {
|
} else if (meshType === 2) {
|
||||||
mesh = this.star.clone();
|
mesh = this.star.clone();
|
||||||
|
score = 20;
|
||||||
material = this.star.materials[0].clone();
|
material = this.star.materials[0].clone();
|
||||||
speed = 0.3;
|
speed = 0.3;
|
||||||
} else if (meshType === 3) {
|
} else if (meshType === 3) {
|
||||||
mesh = this.burger.clone();
|
mesh = this.burger.clone();
|
||||||
|
score = 50;
|
||||||
material = this.burger.materials[0].clone();
|
material = this.burger.materials[0].clone();
|
||||||
speed = 0.4;
|
speed = 0.4;
|
||||||
} else if (meshType === 4) {
|
} else if (meshType === 4) {
|
||||||
mesh = this.parcel.clone();
|
mesh = this.parcel.clone();
|
||||||
|
score = 75;
|
||||||
material = this.parcel.materials[0].clone();
|
material = this.parcel.materials[0].clone();
|
||||||
speed = 0.5;
|
speed = 0.5;
|
||||||
} else if (meshType === 5) {
|
} else if (meshType === 5) {
|
||||||
mesh = this.santa.clone();
|
mesh = this.santa.clone();
|
||||||
|
score = 100;
|
||||||
material = this.santa.materials[0].clone();
|
material = this.santa.materials[0].clone();
|
||||||
speed = 0.6;
|
speed = 0.6;
|
||||||
} else {
|
} else {
|
||||||
|
@ -257,6 +268,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
enemy.burnTime = 0;
|
enemy.burnTime = 0;
|
||||||
enemy.explodingLife = 2;
|
enemy.explodingLife = 2;
|
||||||
enemy.meshType = meshType;
|
enemy.meshType = meshType;
|
||||||
|
enemy.score = score;
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
|
@ -339,14 +351,22 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
|
|
||||||
console.log('exploding enemy');
|
console.log('exploding enemy');
|
||||||
|
|
||||||
this.score += this.level * 100;
|
this.score += enemy.score;
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
event : 'scoreUpdate',
|
||||||
|
score : this.score
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
enemy.exploding = true;
|
enemy.exploding = true;
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
{
|
{
|
||||||
score : this.score,
|
|
||||||
enemy : enemy,
|
enemy : enemy,
|
||||||
event : 'enemyExploded'
|
event : 'enemyExploded'
|
||||||
}
|
}
|
||||||
|
@ -356,8 +376,6 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.explodeKanister = function() {
|
this.explodeKanister = function() {
|
||||||
|
@ -371,14 +389,13 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
this.enemies.map(
|
this.enemies.map(
|
||||||
function(enemy) {
|
function(enemy) {
|
||||||
if (enemy.mesh === mesh && !enemy.burning) {
|
if (enemy.mesh === mesh && !enemy.burning) {
|
||||||
this.score += this.level * 10;
|
|
||||||
console.log('burning enemy ' + mesh.name);
|
console.log('burning enemy ' + mesh.name);
|
||||||
enemy.burning = true;
|
enemy.burning = true;
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
{
|
{
|
||||||
score : this.score,
|
|
||||||
enemy : enemy,
|
enemy : enemy,
|
||||||
event : 'enemyBurned'
|
event : 'enemyBurned'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue