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

beta.r3js.org
-=yb4f310 2018-03-24 11:26:23 +01:00
parent 0b72479c81
commit 9a4850b5d2
1 changed files with 45 additions and 23 deletions

View File

@ -1267,31 +1267,31 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
this.snake.map(
function(body, index) {
if (body.backupMesh) {
/**
* We used to be a corner, change back
* @type {null}
*/
body.mesh.geometry = null;
body.mesh.materials = null;
body.mesh.remove();
body.mesh = body.backupMesh;
body.backupMesh = null;
body.mesh.visible = true;
body.mesh.updateInstance('visible');
body.mesh.updateInstance('position');
}
if (index === 0) {
if (body.backupMesh) {
/**
* We used to be a corner, change back
* @type {null}
*/
body.mesh.geometry = null;
body.mesh.materials = null;
body.mesh.remove();
body.mesh = body.backupMesh;
body.backupMesh = null;
body.mesh.visible = true;
body.mesh.updateInstance('visible');
body.mesh.updateInstance('position');
}
backup = {
position : {
x : body.position.x,
@ -1441,6 +1441,28 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
*/
this.grid[body.position.x][body.position.y] = body;
if (body.backupMesh) {
/**
* We used to be a corner, change back
* @type {null}
*/
body.mesh.geometry = null;
body.mesh.materials = null;
body.mesh.remove();
body.mesh = body.backupMesh;
body.backupMesh = null;
body.mesh.visible = true;
body.mesh.updateInstance('visible');
body.mesh.updateInstance('position');
}
if (body.orientation !== temp.orientation) {
this.createCorner(body, temp);
}