From c822aa11df77f9b6c672312bd901469ee3b56fc1 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 13 Mar 2018 13:45:18 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 15 bytes modified --- 21g30t1e75.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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();