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.parcel.instance.visible = false;
|
||||
this.santa.instance.visible = false;
|
||||
this.kanister.instance.visible = false;
|
||||
|
||||
this.treesBurning = 0;
|
||||
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.setNextKanisterSpawnScore();
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GAME_DATA,
|
||||
{
|
||||
event : 'kanisterCountUpdate',
|
||||
kanisters : this.kanisters
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.spawnEnemy = function() {
|
||||
|
||||
this.enemiesSpawned++;
|
||||
|
||||
this.setLevelProperties();
|
||||
this.spawnEnemy = function(kanister) {
|
||||
|
||||
var enemyType = 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 speed = 1;
|
||||
|
@ -253,7 +243,13 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
score = 100;
|
||||
material = this.santa.materials[0].clone();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -347,18 +343,41 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
enemy.meshType = meshType;
|
||||
enemy.score = score;
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GAME_DATA,
|
||||
{
|
||||
enemiesSpawned : this.enemiesSpawned,
|
||||
enemy : enemy,
|
||||
event : 'enemySpawned'
|
||||
}
|
||||
);
|
||||
if (kanister) {
|
||||
|
||||
} else {
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GAME_DATA,
|
||||
{
|
||||
enemiesSpawned: this.enemiesSpawned,
|
||||
enemy: enemy,
|
||||
event: 'enemySpawned'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
mesh.visible = false;
|
||||
|
@ -460,11 +479,20 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
);
|
||||
};
|
||||
|
||||
this.explodeKanister = function() {
|
||||
this.explodeKanister = function(mesh) {
|
||||
this.kanisters += 1;
|
||||
this.kanisterTime = 0;
|
||||
//this.kanisterTime = 0;
|
||||
// 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) {
|
||||
|
@ -681,7 +709,7 @@ if (this.mouseIsDown)
|
|||
var mesh = intersect.mesh;
|
||||
|
||||
if (mesh.name.indexOf('Kanister') !== -1) {
|
||||
this.explodeKanister();
|
||||
this.explodeKanister(mesh);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue