Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 583 bytes modified

beta.r3js.org
-=yb4f310 2018-03-23 08:59:43 +01:00
parent 733e04ae0b
commit 813cdace37
1 changed files with 40 additions and 15 deletions

View File

@ -105,6 +105,9 @@ this.scene = GameLib.EntityManager.Instance.findComponentById('pllp034hsj');
this.animation = GameLib.EntityManager.Instance.findComponentById('8kb7utb2fn');
this.animationRotation = GameLib.EntityManager.Instance.findComponentById('z628kythyn');
this.particleEnginePickle = GameLib.EntityManager.Instance.findComponentById('ddtkiu8aaa');
this.particlePickle = GameLib.EntityManager.Instance.findComponentById('8lx1d9tnbf');
GameLib.CustomCode.EXPLODE_LIFETIME = this.particlePickle.lifeTime;
/**
* Game objects
@ -126,6 +129,8 @@ this.nextPowerupTime = GameLib.Utils.GetRandomIntInclusive(
);
this.powerups = [];
this.explodeTime = 0;
/**
* 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
@ -140,6 +145,24 @@ this.state = {
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 () {
if (this.noneMesh) {
@ -572,10 +595,10 @@ GameLib.CustomCode.prototype.createGameObject = function(
GameLib.CustomCode.prototype.createPowerup = function(delta) {
if (this.state.exploding) {
return;
}
if (this.state.exploding) {
return;
}
this.powerupTime += delta;
if (this.powerupTime > this.nextPowerupTime) {
@ -594,10 +617,10 @@ GameLib.CustomCode.prototype.createPowerup = function(delta) {
GameLib.CustomCode.prototype.createFood = function(delta) {
if (this.state.exploding) {
return;
}
if (this.state.exploding) {
return;
}
this.foodTime += delta;
if (this.foodTime > this.foodSpeed) {
@ -768,7 +791,7 @@ GameLib.CustomCode.prototype.explode = function(position) {
this.particleEnginePickle.enabled = true;
}
}.bind(this)
/**
* Extend the snake with information from gameObject
@ -951,11 +974,11 @@ GameLib.CustomCode.prototype.createCorner = function(body, temp) {
* @type {function(this:snakeEntityLoaded)}
*/
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
if (this.state.exploding) {
return;
}
if (this.state.exploding) {
return;
}
this.advanceTime += delta;
if (this.advanceTime > this.speed) {
@ -1023,7 +1046,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
if (this.state.exploding === true) {
return;
}
temp = {
position : {
x : body.position.x,
@ -1181,6 +1204,8 @@ GameLib.Event.Subscribe(
);
this.powerups = [];
this.explodeTime = 0;
/**
* Re-initialize our other custom code components
*/