From a7939f8e07bce4810056970861b5a68295755666 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 24 Mar 2018 15:48:47 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 75 bytes modified --- 21g30t1e75.js | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 94461ce..ef31009 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -181,28 +181,28 @@ this.state = { GameLib.CustomCode.prototype.advanceSpeedTimer = function(delta) { - this.speedTimer += delta; - - if (this.speedTimer < GameLib.CustomCode.SPEED_INCREASE_INTERVAL) { - return; - } - - this.speedTimer = 0; - - this.speed -= GameLib.CustomCode.SPEED_GRAIN; + this.speedTimer += delta; - if (this.speed < GameLib.CustomCode.MAX_SPEED) { - this.speed = GameLib.CustomCode.MAX_SPEED; - } + if (this.speedTimer < GameLib.CustomCode.SPEED_INCREASE_INTERVAL) { + return; + } - this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN; + this.speedTimer = 0; + + this.speed -= GameLib.CustomCode.SPEED_GRAIN; + + if (this.speed < GameLib.CustomCode.MAX_SPEED) { + this.speed = GameLib.CustomCode.MAX_SPEED; + } + + this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN; + + if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) { + this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED; + } + + console.log(this.animation.translationSpeed + ':' + this.speed ); - if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) { - this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED; - } - - console.log(this.animation.translationSpeed + ':' + this.speed ); - }.bind(this) GameLib.CustomCode.prototype.displayHUD = function() { @@ -1206,15 +1206,15 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation this.extendSpeedGrain = (GameLib.CustomCode.SPEED_INITIAL - GameLib.CustomCode.MAX_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length) var animationSpeedGrain = (GameLib.CustomCode.MAX_ANIMATION_SPEED - GameLib.CustomCode.MIN_ANIMATION_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length) - + this.speed -= this.extendSpeedGrain; if (this.speed < GameLib.CustomCode.MAX_SPEED) { this.speed = GameLib.CustomCode.MAX_SPEED; } - + this.animation.translationSpeed += animationSpeedGrain; - + if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) { this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED; } @@ -1245,13 +1245,13 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) { if (gameObject.type === GameLib.CustomCode.POWERUP_SPEED) { - this.speed -= GameLib.CustomCode.SPEED_GRAIN; + this.speed -= GameLib.CustomCode.POWERUP_SPEED_GRAIN; if (this.speed < GameLib.CustomCode.MAX_SPEED) { this.speed = GameLib.CustomCode.MAX_SPEED; } - this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN; + this.animation.translationSpeed += GameLib.CustomCode.POWERUP_ANIMATION_SPEED_GRAIN; if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) { this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED; @@ -1261,13 +1261,13 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) { if (gameObject.type === GameLib.CustomCode.POWERUP_SLOW) { - this.speed += GameLib.CustomCode.SPEED_GRAIN; + this.speed += GameLib.CustomCode.POWERUP_SPEED_GRAIN; if (this.speed > GameLib.CustomCode.MIN_SPEED) { this.speed = GameLib.CustomCode.MIN_SPEED; } - this.animation.translationSpeed -= GameLib.CustomCode.ANIMATION_SPEED_GRAIN; + this.animation.translationSpeed -= GameLib.CustomCode.POWERUP_ANIMATION_SPEED_GRAIN; if (this.animation.translationSpeed < GameLib.CustomCode.MIN_ANIMATION_SPEED) { this.animation.translationSpeed = GameLib.CustomCode.MIN_ANIMATION_SPEED; @@ -1777,8 +1777,8 @@ GameLib.Event.Subscribe( GameLib.CustomCode.POWERUP_WAIT_TIME_MAX ); - this.explodeTime = 0; - this.speedTimer = 0; + this.explodeTime = 0; + this.speedTimer = 0; /** * Re-initialize our other custom code components