diff --git a/21g30t1e75.js b/21g30t1e75.js index ad20f8c..76eceff 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -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;