Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 185 bytes modified
parent
8876d30a3f
commit
5f5429f814
|
@ -128,13 +128,15 @@ this.meshPatty = this.createGameMesh(this.imagePatty);
|
||||||
* @param position
|
* @param position
|
||||||
* @param orientation
|
* @param orientation
|
||||||
* @param flip
|
* @param flip
|
||||||
|
* @param backupMesh
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.CustomCode.SnakeBody = function(
|
GameLib.CustomCode.SnakeBody = function(
|
||||||
mesh,
|
mesh,
|
||||||
position,
|
position,
|
||||||
orientation,
|
orientation,
|
||||||
flip
|
flip,
|
||||||
|
backupMesh
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(mesh)) {
|
if (GameLib.Utils.UndefinedOrNull(mesh)) {
|
||||||
|
@ -161,6 +163,11 @@ GameLib.CustomCode.SnakeBody = function(
|
||||||
}
|
}
|
||||||
this.flip = flip;
|
this.flip = flip;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(backupMesh)) {
|
||||||
|
backupMesh = null;
|
||||||
|
}
|
||||||
|
this.backupMesh = backupMesh;
|
||||||
|
|
||||||
this.applyToMesh(flip);
|
this.applyToMesh(flip);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,7 +202,7 @@ GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function(flip) {
|
||||||
|
|
||||||
this.mesh.rotation.z = this.orientation * Math.PI / 2;
|
this.mesh.rotation.z = this.orientation * Math.PI / 2;
|
||||||
|
|
||||||
if (flip) {
|
if (this.backupMesh && flip) {
|
||||||
this.mesh.rotation.z += Math.PI / 2;
|
this.mesh.rotation.z += Math.PI / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,6 +282,8 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
body.position.y = backup.position.y;
|
body.position.y = backup.position.y;
|
||||||
body.orientation = backup.orientation;
|
body.orientation = backup.orientation;
|
||||||
|
|
||||||
|
backup = temp;
|
||||||
|
|
||||||
if (body.backupMesh) {
|
if (body.backupMesh) {
|
||||||
/**
|
/**
|
||||||
* We used to be a corner, change back
|
* We used to be a corner, change back
|
||||||
|
@ -314,8 +323,6 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
body.orientation = this.snake[index - 1].orientation;
|
body.orientation = this.snake[index - 1].orientation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
backup = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.applyToMesh(this.state.flip);
|
body.applyToMesh(this.state.flip);
|
||||||
|
|
Loading…
Reference in New Issue