From c17ed61661a479281d8dc8e0ef0a40c9621476ba Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 15 Mar 2018 15:17:44 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 937 bytes modified --- 21g30t1e75.js | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index eb469fa..d9c01e6 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -252,7 +252,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { }, orientation : body.orientation } - + body.advance( this.state.orientation ); @@ -267,20 +267,51 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { }, orientation : body.orientation } - + body.position.x = backup.position.x; body.position.y = backup.position.y; body.orientation = backup.orientation; + 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.mesh.visible = true; + + body.mesh.updateInstance('visible'); + } + + if (body.orientation !== temp.orientation) { + /** + * Our orientation changed - we should make a corner + */ + body.backupMesh = body.mesh; + + body.backupMesh.visible = false; + + body.backupMesh.updateInstance('visible'); + + body.mesh = this.meshBreadCorner.clone(); + } + backup = temp; } - + body.applyToMesh(); }.bind(this) ) - return; + }.bind(this); /*