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

beta.r3js.org
-=yb4f310 2018-03-15 11:44:37 +01:00
parent 4853591f23
commit 6a864c95e8
1 changed files with 26 additions and 16 deletions

View File

@ -232,20 +232,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
} else {
if (
index === 1 &&
this.state.turning &&
body.bodyType !== GameLib.CustomCode.BODY_TYPE_TAIL
) {
body.backupMesh = body.mesh;
body.mesh = this.meshBreadCorner.clone();
body.bodyType = GameLib.CustomCode.BODY_TYPE_CORNER;
this.state.turning = false;
}
var temp = {
x : body.position.x,
@ -257,8 +244,31 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
body.position.x = backup.x;
body.position.y = backup.y;
body.orientation = backup.orientation;
body.bodyType = backup.bodyType;
if (
index === 1 &&
this.state.turning &&
body.bodyType !== GameLib.CustomCode.BODY_TYPE_TAIL
) {
body.backupMesh = body.mesh;
body.backupMesh.visible = false;
body.backupMesh.updateInstance('visible');
body.mesh = this.meshBreadCorner.clone();
body.bodyType = GameLib.CustomCode.BODY_TYPE_CORNER;
this.state.turning = false;
} else {
body.bodyType = backup.bodyType;
}
backup.x = temp.x;
backup.y = temp.y;
backup.orientation = temp.orientation;