Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 290 bytes modified

beta.r3js.org
-=yb4f310 2018-03-23 13:30:01 +01:00
parent 14e7e9b774
commit 7540355872
1 changed files with 9 additions and 2 deletions

View File

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