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 orientation
|
||||
* @param flip
|
||||
* @param backupMesh
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.CustomCode.SnakeBody = function(
|
||||
mesh,
|
||||
position,
|
||||
orientation,
|
||||
flip
|
||||
flip,
|
||||
backupMesh
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(mesh)) {
|
||||
|
@ -161,6 +163,11 @@ GameLib.CustomCode.SnakeBody = function(
|
|||
}
|
||||
this.flip = flip;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(backupMesh)) {
|
||||
backupMesh = null;
|
||||
}
|
||||
this.backupMesh = backupMesh;
|
||||
|
||||
this.applyToMesh(flip);
|
||||
};
|
||||
|
||||
|
@ -195,7 +202,7 @@ GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function(flip) {
|
|||
|
||||
this.mesh.rotation.z = this.orientation * Math.PI / 2;
|
||||
|
||||
if (flip) {
|
||||
if (this.backupMesh && flip) {
|
||||
this.mesh.rotation.z += Math.PI / 2;
|
||||
}
|
||||
|
||||
|
@ -275,6 +282,8 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
|||
body.position.y = backup.position.y;
|
||||
body.orientation = backup.orientation;
|
||||
|
||||
backup = temp;
|
||||
|
||||
if (body.backupMesh) {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
backup = temp;
|
||||
}
|
||||
|
||||
body.applyToMesh(this.state.flip);
|
||||
|
|
Loading…
Reference in New Issue