diff --git a/21g30t1e75.js b/21g30t1e75.js index d1db342..fc2f8db 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -191,12 +191,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { this.snake.map( function(body, index) { - - var tempPosition = { - x : body.position.x, - y : body.position.y - }; - + if (index === 0) { position.x = body.position.x; @@ -205,11 +200,18 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { body.advance(this.direction, this.rotation); } else { + + var tempPosition = { + x : body.position.x, + y : body.position.y + }; + body.position.x = position.x; body.position.y = position.y; position.x = tempPosition.x; position.y = tempPosition.y; + } body.applyToMesh();