From 9a4850b5d29169a891e07b9681747d031a0d2b44 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 24 Mar 2018 11:26:23 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 256 bytes modified --- 21g30t1e75.js | 68 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index d032d70..175af8f 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -1267,31 +1267,31 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { this.snake.map( function(body, index) { - - if (body.backupMesh) { - /** - * We used to be a corner, change back - * @type {null} - */ - body.mesh.geometry = null; - - body.mesh.materials = null; - - body.mesh.remove(); - - body.mesh = body.backupMesh; - - body.backupMesh = null; - - body.mesh.visible = true; - - body.mesh.updateInstance('visible'); - - body.mesh.updateInstance('position'); - } - + if (index === 0) { + if (body.backupMesh) { + /** + * We used to be a corner, change back + * @type {null} + */ + body.mesh.geometry = null; + + body.mesh.materials = null; + + body.mesh.remove(); + + body.mesh = body.backupMesh; + + body.backupMesh = null; + + body.mesh.visible = true; + + body.mesh.updateInstance('visible'); + + body.mesh.updateInstance('position'); + } + backup = { position : { x : body.position.x, @@ -1441,6 +1441,28 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { */ this.grid[body.position.x][body.position.y] = body; + if (body.backupMesh) { + /** + * We used to be a corner, change back + * @type {null} + */ + body.mesh.geometry = null; + + body.mesh.materials = null; + + body.mesh.remove(); + + body.mesh = body.backupMesh; + + body.backupMesh = null; + + body.mesh.visible = true; + + body.mesh.updateInstance('visible'); + + body.mesh.updateInstance('position'); + } + if (body.orientation !== temp.orientation) { this.createCorner(body, temp); }