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

beta.r3js.org
-=yb4f310 2018-03-23 13:04:50 +01:00
parent a8e9f5af91
commit ac0610e7ab
1 changed files with 32 additions and 0 deletions

View File

@ -1036,6 +1036,28 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
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,
@ -1063,6 +1085,16 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
switch (gameObject.objectType) {
case GameLib.CustomCode.OBJECT_TYPE_SNAKE_BODY :
if (body.orientation !== backup.orientation) {
body.orientation = backup.orientation;
body.flip = backup.flip;
backup.orientation = this.state.orientation;
backup.flip = this.state.flip;
this.createCorner(body, backup);
body.applyToMesh();
}
this.explode(body.position);
break;
case GameLib.CustomCode.OBJECT_TYPE_FOOD :