Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 107 bytes modified
parent
730d92b7c3
commit
d7c1739d11
|
@ -915,6 +915,32 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
|||
|
||||
backup.orientation = body.orientation;
|
||||
backup.flip = body.flip;
|
||||
|
||||
if (!advanced) {
|
||||
|
||||
this.explode(body.position);
|
||||
|
||||
} else {
|
||||
|
||||
var gameObject = this.grid[body.position.x][body.position.y];
|
||||
|
||||
switch (gameObject.objectType) {
|
||||
case GameLib.CustomCode.OBJECT_TYPE_SNAKE_BODY :
|
||||
this.explode(body.position);
|
||||
break;
|
||||
case GameLib.CustomCode.OBJECT_TYPE_FOOD :
|
||||
this.extend(gameObject, body.position, body.orientation);
|
||||
break;
|
||||
case GameLib.CustomCode.OBJECT_TYPE_POWERUP:
|
||||
this.powerup(gameObject);
|
||||
break;
|
||||
default:
|
||||
this.grid[body.position.x][body.position.y] = body;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.state.eating === true) {
|
||||
|
@ -1032,31 +1058,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
|||
|
||||
this.state.eating = false;
|
||||
|
||||
var head = this.snake[0];
|
||||
|
||||
if (!advanced) {
|
||||
|
||||
this.explode(head.position);
|
||||
|
||||
} else {
|
||||
|
||||
var gameObject = this.grid[head.position.x][head.position.y];
|
||||
|
||||
switch (gameObject.objectType) {
|
||||
case GameLib.CustomCode.OBJECT_TYPE_SNAKE_BODY :
|
||||
this.explode(head.position);
|
||||
break;
|
||||
case GameLib.CustomCode.OBJECT_TYPE_FOOD :
|
||||
this.extend(gameObject, head.position, head.orientation);
|
||||
break;
|
||||
case GameLib.CustomCode.OBJECT_TYPE_POWERUP:
|
||||
this.powerup(gameObject);
|
||||
break;
|
||||
default:
|
||||
this.grid[head.position.x][head.position.y] = head;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.visualizeGrid();
|
||||
|
||||
|
|
Loading…
Reference in New Issue