From 6a864c95e8379c09d292ba80d631eaed0c6bad6a Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 15 Mar 2018 11:44:37 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 120 bytes modified --- 21g30t1e75.js | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 59b0dd9..8f309fe 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -232,20 +232,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { } else { - if ( - index === 1 && - this.state.turning && - body.bodyType !== GameLib.CustomCode.BODY_TYPE_TAIL - ) { - - body.backupMesh = body.mesh; - - body.mesh = this.meshBreadCorner.clone(); - - body.bodyType = GameLib.CustomCode.BODY_TYPE_CORNER; - - this.state.turning = false; - } + var temp = { x : body.position.x, @@ -257,8 +244,31 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { body.position.x = backup.x; body.position.y = backup.y; body.orientation = backup.orientation; - body.bodyType = backup.bodyType; - + + if ( + index === 1 && + this.state.turning && + body.bodyType !== GameLib.CustomCode.BODY_TYPE_TAIL + ) { + + body.backupMesh = body.mesh; + + body.backupMesh.visible = false; + + body.backupMesh.updateInstance('visible'); + + body.mesh = this.meshBreadCorner.clone(); + + body.bodyType = GameLib.CustomCode.BODY_TYPE_CORNER; + + this.state.turning = false; + + } else { + + body.bodyType = backup.bodyType; + + } + backup.x = temp.x; backup.y = temp.y; backup.orientation = temp.orientation;