Update: CC - Before Render - Moorcow (a2ow5l92js.js) 573 bytes modified
parent
e07d27a56b
commit
9e42b648ef
|
@ -43,6 +43,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
this.burger.instance.visible = false;
|
this.burger.instance.visible = false;
|
||||||
this.parcel.instance.visible = false;
|
this.parcel.instance.visible = false;
|
||||||
this.santa.instance.visible = false;
|
this.santa.instance.visible = false;
|
||||||
|
this.kanister.instance.visible = false;
|
||||||
|
|
||||||
this.treesBurning = 0;
|
this.treesBurning = 0;
|
||||||
this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3);
|
this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3);
|
||||||
|
@ -196,30 +197,19 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.spawnKanister = function() {
|
|
||||||
|
|
||||||
console.log('spawning kanister');
|
this.spawnEnemy = function(kanister) {
|
||||||
|
|
||||||
this.setNextKanisterSpawnScore();
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
|
||||||
event : 'kanisterCountUpdate',
|
|
||||||
kanisters : this.kanisters
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.spawnEnemy = function() {
|
|
||||||
|
|
||||||
this.enemiesSpawned++;
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
if (kanister) {
|
||||||
|
meshType = 6;
|
||||||
|
} else {
|
||||||
|
this.enemiesSpawned++;
|
||||||
|
this.setLevelProperties();
|
||||||
|
}
|
||||||
|
|
||||||
var y = GameLib.Utils.GetRandomIntInclusive(2, 10);
|
var y = GameLib.Utils.GetRandomIntInclusive(2, 10);
|
||||||
|
|
||||||
var speed = 1;
|
var speed = 1;
|
||||||
|
@ -253,7 +243,13 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
score = 100;
|
score = 100;
|
||||||
material = this.santa.materials[0].clone();
|
material = this.santa.materials[0].clone();
|
||||||
speed = 0.6;
|
speed = 0.6;
|
||||||
} else {
|
} else if (meshType === 6) {
|
||||||
|
mesh = this.kanister.clone();
|
||||||
|
score = 100;
|
||||||
|
material = this.kanister.materials[0].clone();
|
||||||
|
speed = 0.7;
|
||||||
|
}
|
||||||
|
else {
|
||||||
console.log('unknown mesh type : ' + meshType);
|
console.log('unknown mesh type : ' + meshType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,18 +343,41 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
enemy.meshType = meshType;
|
enemy.meshType = meshType;
|
||||||
enemy.score = score;
|
enemy.score = score;
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
if (kanister) {
|
||||||
GameLib.Event.GAME_DATA,
|
|
||||||
{
|
} else {
|
||||||
enemiesSpawned : this.enemiesSpawned,
|
|
||||||
enemy : enemy,
|
GameLib.Event.Emit(
|
||||||
event : 'enemySpawned'
|
GameLib.Event.GAME_DATA,
|
||||||
}
|
{
|
||||||
);
|
enemiesSpawned: this.enemiesSpawned,
|
||||||
|
enemy: enemy,
|
||||||
|
event: 'enemySpawned'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this.enemies.push(enemy);
|
this.enemies.push(enemy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.spawnKanister = function() {
|
||||||
|
|
||||||
|
console.log('spawning kanister');
|
||||||
|
|
||||||
|
this.setNextKanisterSpawnScore();
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
event : 'kanisterCountUpdate',
|
||||||
|
kanisters : this.kanisters
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.spawnEnemy(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.explodeMesh = function(mesh) {
|
this.explodeMesh = function(mesh) {
|
||||||
|
|
||||||
mesh.visible = false;
|
mesh.visible = false;
|
||||||
|
@ -460,11 +479,20 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.explodeKanister = function() {
|
this.explodeKanister = function(mesh) {
|
||||||
this.kanisters += 1;
|
this.kanisters += 1;
|
||||||
this.kanisterTime = 0;
|
//this.kanisterTime = 0;
|
||||||
// this.fuelFinished = false;
|
// this.fuelFinished = false;
|
||||||
this.explodeMesh(this.kanister);
|
this.explodeMesh(mesh);
|
||||||
|
if (mesh.explodeParticleEngine) {
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(mesh.waiting)) {
|
||||||
|
mesh.waiting = true;
|
||||||
|
} else {
|
||||||
|
mesh.explodeParticleEngine.remove();
|
||||||
|
mesh.explodeParticleEngine = null;
|
||||||
|
delete mesh.waiting;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.burn = function(mesh) {
|
this.burn = function(mesh) {
|
||||||
|
@ -681,7 +709,7 @@ if (this.mouseIsDown)
|
||||||
var mesh = intersect.mesh;
|
var mesh = intersect.mesh;
|
||||||
|
|
||||||
if (mesh.name.indexOf('Kanister') !== -1) {
|
if (mesh.name.indexOf('Kanister') !== -1) {
|
||||||
this.explodeKanister();
|
this.explodeKanister(mesh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue