Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 390 bytes modified
parent
e698a09897
commit
32999117e4
|
@ -4,6 +4,18 @@ if (this.parentEntity === data.entity) {
|
||||||
return;
|
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();
|
this.runtime = GameLib.Utils.GetRuntime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,9 +44,7 @@ this.scene = GameLib.EntityManager.Instance.findComponentById('pllp034hsj');
|
||||||
* Game objects
|
* Game objects
|
||||||
*/
|
*/
|
||||||
this.snake = [];
|
this.snake = [];
|
||||||
|
this.grid = [[]];
|
||||||
GameLib.CustomCode.BODY_TYPE_HEAD = 0x1;
|
|
||||||
GameLib.CustomCode.BODY_TYPE_TAIL = 0x2;
|
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
|
@ -121,6 +131,23 @@ GameLib.Event.Subscribe(
|
||||||
this.cloneBody(GameLib.CustomCode.BODY_TYPE_TAIL)
|
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.initialized = false;
|
||||||
this.beforeRender.entityLoaded = this;
|
this.beforeRender.entityLoaded = this;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue