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

beta.r3js.org
-=yb4f310 2018-03-23 13:35:44 +01:00
parent 9c622b865e
commit 8211e298c2
1 changed files with 36 additions and 0 deletions

View File

@ -1101,6 +1101,42 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
// body.applyToMesh();
//}
if (!gameObject.isTail) {
if (body.orientation !== backup.orientation) {
/**
* This head is bent
*/
body.applyToMesh();
body.backupMesh = body.mesh;
if (body.orientation === GameLib.CustomCode.ORIENTATION_UP) {
body.backupMesh.position.y -= 0.5 * GameLib.CustomCode.BODY_SCALE_Y;
}
if (body.orientation === GameLib.CustomCode.ORIENTATION_DOWN) {
body.backupMesh.position.y += 0.5 * GameLib.CustomCode.BODY_SCALE_Y;
}
if (body.orientation === GameLib.CustomCode.ORIENTATION_LEFT) {
body.backupMesh.position.x += 0.5 * GameLib.CustomCode.BODY_SCALE_X;
}
if (body.orientation === GameLib.CustomCode.ORIENTATION_RIGHT) {
body.backupMesh.position.x -= 0.5 * GameLib.CustomCode.BODY_SCALE_X;
}
body.mesh = this.createGameMesh(this.materialBreadCorner);
body.mesh.position.z = 5;
body.mesh.updateInstance('position');
body.mesh.visible = true;
body.mesh.updateInstance('visible');
}
this.explode(body.position);
}
break;