Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 449 bytes modified
parent
53338d8a49
commit
cfdba955d2
|
@ -24,6 +24,10 @@ GameLib.CustomCode.ORIENTATION_LEFT = 1;
|
||||||
GameLib.CustomCode.ORIENTATION_DOWN = 2;
|
GameLib.CustomCode.ORIENTATION_DOWN = 2;
|
||||||
GameLib.CustomCode.ORIENTATION_RIGHT = 3;
|
GameLib.CustomCode.ORIENTATION_RIGHT = 3;
|
||||||
|
|
||||||
|
GameLib.CustomCode.FOOD_SPEED_INITIAL = 3;
|
||||||
|
GameLib.CustomCode.MAX_FOOD_ITEMS = 6;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get runtime
|
* Get runtime
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +67,9 @@ this.snake = [];
|
||||||
this.grid = [];
|
this.grid = [];
|
||||||
this.speed = GameLib.CustomCode.SPEED_INITIAL;
|
this.speed = GameLib.CustomCode.SPEED_INITIAL;
|
||||||
this.advanceTime = 0;
|
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) -
|
* 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);
|
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
|
* GameLib.CustomCode.SnakeBody
|
||||||
* @param mesh
|
* @param mesh
|
||||||
|
@ -300,10 +323,6 @@ GameLib.CustomCode.SnakeBody.prototype.advance = function(orientation, flip) {
|
||||||
this.flip = flip;
|
this.flip = flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.createFood = function(delta) {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
this.advanceTime += delta;
|
this.advanceTime += delta;
|
||||||
|
@ -552,8 +571,12 @@ function(y) {
|
||||||
/**
|
/**
|
||||||
* Other Settings
|
* Other Settings
|
||||||
*/
|
*/
|
||||||
|
this.advanceTime = 0;
|
||||||
this.speed = GameLib.CustomCode.SPEED_INITIAL;
|
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
|
* Re-initialize our other custom code components
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue