Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 583 bytes modified
parent
733e04ae0b
commit
813cdace37
|
@ -105,6 +105,9 @@ this.scene = GameLib.EntityManager.Instance.findComponentById('pllp034hsj');
|
||||||
this.animation = GameLib.EntityManager.Instance.findComponentById('8kb7utb2fn');
|
this.animation = GameLib.EntityManager.Instance.findComponentById('8kb7utb2fn');
|
||||||
this.animationRotation = GameLib.EntityManager.Instance.findComponentById('z628kythyn');
|
this.animationRotation = GameLib.EntityManager.Instance.findComponentById('z628kythyn');
|
||||||
this.particleEnginePickle = GameLib.EntityManager.Instance.findComponentById('ddtkiu8aaa');
|
this.particleEnginePickle = GameLib.EntityManager.Instance.findComponentById('ddtkiu8aaa');
|
||||||
|
this.particlePickle = GameLib.EntityManager.Instance.findComponentById('8lx1d9tnbf');
|
||||||
|
|
||||||
|
GameLib.CustomCode.EXPLODE_LIFETIME = this.particlePickle.lifeTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Game objects
|
* Game objects
|
||||||
|
@ -126,6 +129,8 @@ this.nextPowerupTime = GameLib.Utils.GetRandomIntInclusive(
|
||||||
);
|
);
|
||||||
this.powerups = [];
|
this.powerups = [];
|
||||||
|
|
||||||
|
this.explodeTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Orientation is 0, 1, 2 or 3, (up, left, down, right) -
|
* Orientation is 0, 1, 2 or 3, (up, left, down, right) -
|
||||||
* This is also the amount we need to multiply with PI to get the mesh rotation
|
* This is also the amount we need to multiply with PI to get the mesh rotation
|
||||||
|
@ -140,6 +145,24 @@ this.state = {
|
||||||
lives : 2
|
lives : 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.CustomCode.prototype.waitReload = function(delta) {
|
||||||
|
|
||||||
|
this.explodeTime += delta;
|
||||||
|
|
||||||
|
if (this.explodeTime < GameLib.CustomCode.EXPLODE_LIFETIME) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.particleEnginePickle.enabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We need to revert to a good state
|
||||||
|
*/
|
||||||
|
|
||||||
|
console.warn('revert to good state');
|
||||||
|
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.visualizeGrid = function () {
|
GameLib.CustomCode.prototype.visualizeGrid = function () {
|
||||||
|
|
||||||
if (this.noneMesh) {
|
if (this.noneMesh) {
|
||||||
|
@ -572,10 +595,10 @@ GameLib.CustomCode.prototype.createGameObject = function(
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.createPowerup = function(delta) {
|
GameLib.CustomCode.prototype.createPowerup = function(delta) {
|
||||||
|
|
||||||
if (this.state.exploding) {
|
if (this.state.exploding) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.powerupTime += delta;
|
this.powerupTime += delta;
|
||||||
|
|
||||||
if (this.powerupTime > this.nextPowerupTime) {
|
if (this.powerupTime > this.nextPowerupTime) {
|
||||||
|
@ -594,10 +617,10 @@ GameLib.CustomCode.prototype.createPowerup = function(delta) {
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.createFood = function(delta) {
|
GameLib.CustomCode.prototype.createFood = function(delta) {
|
||||||
|
|
||||||
if (this.state.exploding) {
|
if (this.state.exploding) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.foodTime += delta;
|
this.foodTime += delta;
|
||||||
|
|
||||||
if (this.foodTime > this.foodSpeed) {
|
if (this.foodTime > this.foodSpeed) {
|
||||||
|
@ -768,7 +791,7 @@ GameLib.CustomCode.prototype.explode = function(position) {
|
||||||
|
|
||||||
this.particleEnginePickle.enabled = true;
|
this.particleEnginePickle.enabled = true;
|
||||||
|
|
||||||
}
|
}.bind(this)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the snake with information from gameObject
|
* Extend the snake with information from gameObject
|
||||||
|
@ -951,11 +974,11 @@ GameLib.CustomCode.prototype.createCorner = function(body, temp) {
|
||||||
* @type {function(this:snakeEntityLoaded)}
|
* @type {function(this:snakeEntityLoaded)}
|
||||||
*/
|
*/
|
||||||
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
if (this.state.exploding) {
|
if (this.state.exploding) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.advanceTime += delta;
|
this.advanceTime += delta;
|
||||||
|
|
||||||
if (this.advanceTime > this.speed) {
|
if (this.advanceTime > this.speed) {
|
||||||
|
@ -1023,7 +1046,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
if (this.state.exploding === true) {
|
if (this.state.exploding === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = {
|
temp = {
|
||||||
position : {
|
position : {
|
||||||
x : body.position.x,
|
x : body.position.x,
|
||||||
|
@ -1181,6 +1204,8 @@ GameLib.Event.Subscribe(
|
||||||
);
|
);
|
||||||
this.powerups = [];
|
this.powerups = [];
|
||||||
|
|
||||||
|
this.explodeTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-initialize our other custom code components
|
* Re-initialize our other custom code components
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue