From 813cdace37a0198665924d266f86e3fca5132fe7 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 23 Mar 2018 08:59:43 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 583 bytes modified --- 21g30t1e75.js | 55 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 96b4543..d930cf9 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -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 */