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

beta.r3js.org
-=yb4f310 2018-03-20 15:07:58 +01:00
parent 53338d8a49
commit cfdba955d2
1 changed files with 28 additions and 5 deletions

View File

@ -24,6 +24,10 @@ GameLib.CustomCode.ORIENTATION_LEFT = 1;
GameLib.CustomCode.ORIENTATION_DOWN = 2;
GameLib.CustomCode.ORIENTATION_RIGHT = 3;
GameLib.CustomCode.FOOD_SPEED_INITIAL = 3;
GameLib.CustomCode.MAX_FOOD_ITEMS = 6;
/**
* Get runtime
*/
@ -63,6 +67,9 @@ this.snake = [];
this.grid = [];
this.speed = GameLib.CustomCode.SPEED_INITIAL;
this.advanceTime = 0;
this.foodTime = 0;
this.foodSpeed = GameLib.CustomCode.FOOD_SPEED_INITIAL;
this.foodItems = [];
/**
* Orientation is 0, 1, 2 or 3, (up, left, down, right) -
@ -161,6 +168,22 @@ this.meshBreadCorner.useQuaternion = false;
this.meshPatty = this.createGameMesh(this.imagePatty);
GameLib.CustomCode.prototype.createFood = function(delta) {
this.foodTime += delta;
if (this.foodTime > this.foodSpeed) {
this.foodTime = 0;
} else {
return;
}
};
/**
* GameLib.CustomCode.SnakeBody
* @param mesh
@ -300,10 +323,6 @@ GameLib.CustomCode.SnakeBody.prototype.advance = function(orientation, flip) {
this.flip = flip;
}
GameLib.CustomCode.prototype.createFood = function(delta) {
};
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
this.advanceTime += delta;
@ -552,8 +571,12 @@ function(y) {
/**
* Other Settings
*/
this.advanceTime = 0;
this.speed = GameLib.CustomCode.SPEED_INITIAL;
this.foodTime = 0;
this.foodSpeed = GameLib.CustomCode.FOOD_SPEED_INITIAL;
this.foodItems = [];
/**
* Re-initialize our other custom code components
*/