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 */