From f2572e8c38caf6b365191c028f267251b08878b9 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 24 Mar 2018 15:43:53 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 607 bytes modified --- 21g30t1e75.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/21g30t1e75.js b/21g30t1e75.js index a3feae9..45e302f 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -176,6 +176,30 @@ this.state = { gameOver : false }; +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; + + 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; + } + +}.bind(this) + GameLib.CustomCode.prototype.displayHUD = function() { this.canvasHUD.clear();