diff --git a/21g30t1e75.js b/21g30t1e75.js index 236863f..ab43fa7 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -1151,8 +1151,15 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) { /** * Create a new empty object at the current grid position (free it up) */ - this.grid[body.position.x][body.position.y] = new GameLib.CustomCode.GameObject(); - + if (this.grid[body.position.x][body.position.y] === this.snake[0]) { + /** + * Its possible that we just nearly missed the tail with the head - and avoid a + * collision - in this case - don't reset this position since it belongs to the head + */ + } else { + this.grid[body.position.x][body.position.y] = new GameLib.CustomCode.GameObject(); + } + /** * Assign the new location to the body */