From 102b6070a3547731a61dc8f09193e66332628ea6 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 15 Mar 2018 13:01:02 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 342 bytes modified --- 21g30t1e75.js | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index b7be6a4..99b9331 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -236,37 +236,29 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { return; } - this.advanceTime += delta; + var tail = this.snake.pop(); + var parent = null; - if (this.advanceTime > this.speed) { - this.advanceTime = 0; - } else { - return; - } + var newSnake = []; - var tail = this.snake.pop(); - var parent = null; - - var newSnake = []; - - while (this.snake.length > 0) { - - parent = this.snake.pop(); - - tail.position.x = parent.position.x; - tail.position.y = parent.position.y; - tail.orientation = parent.orientation; + while (this.snake.length > 0) { - tail.applyToMesh(); - - newSnake.push(tail); - - tail = parent; - } - - this.snake = newSnake; - - return; + parent = this.snake.pop(); + + tail.position.x = parent.position.x; + tail.position.y = parent.position.y; + tail.orientation = parent.orientation; + + tail.applyToMesh(); + + newSnake.push(tail); + + tail = parent; + } + + this.snake = newSnake; + + return; this.snake = this.snake.map(