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

beta.r3js.org
-=yb4f310 2018-03-22 13:04:16 +01:00
parent 8891351615
commit 3e0239b9a8
1 changed files with 4 additions and 53 deletions

View File

@ -134,7 +134,7 @@ this.state = {
orientation : 0, orientation : 0,
turning : false, turning : false,
flip : 0, flip : 0,
eating : false eating : 0
}; };
GameLib.CustomCode.prototype.visualizeGrid = function () { GameLib.CustomCode.prototype.visualizeGrid = function () {
@ -726,52 +726,6 @@ GameLib.CustomCode.prototype.initializeGrid = function() {
}.bind(this); }.bind(this);
// GameLib.CustomCode.prototype.rebuildGrid = function() {
//
// this.initializeGrid();
//
// /**
// * First add all the snake body parts
// */
// this.snake.map(
// function(body, index) {
// this.grid[body.position.x][body.position.y] = {
// occupied: true,
// type : GameLib.CustomCode.OBJECT_TYPE_SNAKE_BODY,
// index : index
// }
// }.bind(this)
// );
//
// /**
// * Then add all the food bits
// */
// this.food.map(
// function(food, index) {
// this.grid[food.position.x][food.position.y] = {
// occupied: true,
// type : GameLib.CustomCode.OBJECT_TYPE_FOOD,
// index : index
// }
// }.bind(this)
// );
//
// /**
// * And also all the power ups
// */
// this.powerups.map(
// function(powerup, index) {
// this.grid[powerup.position.x][powerup.position.y] = {
// occupied: true,
// type : GameLib.CustomCode.OBJECT_TYPE_POWERUP,
// index : index
// }
// }.bind(this)
// );
//
// }.bind(this);
/** /**
* Explode the snake * Explode the snake
* @param position * @param position
@ -869,7 +823,7 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation
body.mesh.updateInstance('position'); body.mesh.updateInstance('position');
this.state.eating = true; this.state.eating = 2;
this.snake.splice(1, 0, body); this.snake.splice(1, 0, body);
@ -977,7 +931,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
backup.flip = body.flip; backup.flip = body.flip;
} }
if (this.state.eating) { if (this.state.eating > 0) {
return return
} }
@ -1082,16 +1036,13 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
backup = temp; backup = temp;
} }
//if (!body.isTail) {
body.applyToMesh(); body.applyToMesh();
//}
}.bind(this) }.bind(this)
) )
this.state.turning = false; this.state.turning = false;
this.state.eating = false; this.state.eating -= 1;
this.visualizeGrid(); this.visualizeGrid();