From 5b5d220944863429bfcd5fd1f03245e555142a9e Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 15 Mar 2018 15:24:56 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 42 bytes modified --- 21g30t1e75.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index d3afee2..c26fb27 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -245,17 +245,17 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { if (index === 0) { - body.advance( - this.state.orientation - ); - - backup = { + backup = { position : { x : body.position.x, y : body.position.y }, orientation : body.orientation } + + body.advance( + this.state.orientation + ); } if (index > 0) { @@ -284,13 +284,15 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { body.mesh.remove(); body.mesh = body.backupMesh; + + body.backupMesh = null; body.mesh.visible = true; body.mesh.updateInstance('visible'); } - if (body.orientation !== backup.orientation) { + if (body.orientation !== this.snake[index-1].orientation) { /** * Our orientation changed - we should make a corner */