Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 290 bytes modified
parent
14e7e9b774
commit
7540355872
|
@ -1151,8 +1151,15 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
/**
|
/**
|
||||||
* Create a new empty object at the current grid position (free it up)
|
* 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
|
* Assign the new location to the body
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue