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

beta.r3js.org
-=yb4f310 2018-03-12 14:46:14 +01:00
parent e698a09897
commit 32999117e4
1 changed files with 31 additions and 4 deletions

View File

@ -4,6 +4,18 @@ if (this.parentEntity === data.entity) {
return;
}
/**
* Defines
*/
GameLib.CustomCode.BODY_TYPE_HEAD = 0x1;
GameLib.CustomCode.BODY_TYPE_TAIL = 0x2;
GameLib.CustomCode.GRID_WIDTH = 11;
GameLib.CustomCode.GRID_HEIGHT = 11;
/**
* Get runtime
*/
this.runtime = GameLib.Utils.GetRuntime();
/**
@ -31,10 +43,8 @@ this.scene = GameLib.EntityManager.Instance.findComponentById('pllp034hsj');
/**
* Game objects
*/
this.snake = [];
GameLib.CustomCode.BODY_TYPE_HEAD = 0x1;
GameLib.CustomCode.BODY_TYPE_TAIL = 0x2;
this.snake = [];
this.grid = [[]];
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
@ -121,6 +131,23 @@ GameLib.Event.Subscribe(
this.cloneBody(GameLib.CustomCode.BODY_TYPE_TAIL)
];
this.grid.map(
function(x) {
x.map(
function(y) {
y.mesh.geometry = null;
y.mesh.materials = null;
y.mesh.remove();
y.taken = false;
y.direction = {
x:0,
y:0
}
}
);
}
);
this.beforeRender.initialized = false;
this.beforeRender.entityLoaded = this;