From 0b5660521a8bf033e80c8143be577e0d531bf0cb Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Mon, 12 Mar 2018 21:09:31 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 149 bytes modified --- 21g30t1e75.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 211bed5..3268b0e 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -190,14 +190,18 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { this.snake = this.snake.reduce( function(result, body, index) { - if ((index + 1) >= this.snake.length) { + if ((index + 1) > this.snake.length) { + /** + * we're done + */ + return result; + } else if ((index + 1) === this.snake.length) { /** * Pop it */ - body.mesh.geometry = null; - body.mesh.materials = null; - body.mesh.remove(); - + this.snake[index + 1].mesh.geometry = null; + this.snake[index + 1].mesh.materials = null; + this.snake[index + 1].mesh.remove(); } else { /** * Move the body over