Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 7 bytes modified
parent
ceef0798c5
commit
600bc4b2cc
|
@ -94,9 +94,9 @@ this.meshBodyPatty = this.createGameMesh(this.imageBodyPatty);
|
||||||
|
|
||||||
GameLib.CustomCode.SnakeBody = function(
|
GameLib.CustomCode.SnakeBody = function(
|
||||||
bodyType,
|
bodyType,
|
||||||
|
mesh,
|
||||||
position,
|
position,
|
||||||
direction,
|
direction
|
||||||
mesh
|
|
||||||
) {
|
) {
|
||||||
if (GameLib.Utils.UndefinedOrNull(position)) {
|
if (GameLib.Utils.UndefinedOrNull(position)) {
|
||||||
position = {
|
position = {
|
||||||
|
@ -115,11 +115,14 @@ GameLib.CustomCode.SnakeBody = function(
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(bodyType)) {
|
if (GameLib.Utils.UndefinedOrNull(bodyType)) {
|
||||||
bodyType = GameLib.CustomCode.BODY_TYPE_HEAD;
|
throw new Error('no body type specified');
|
||||||
}
|
}
|
||||||
this.bodyType = bodyType;
|
this.bodyType = bodyType;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(mesh)) {
|
if (GameLib.Utils.UndefinedOrNull(mesh)) {
|
||||||
|
throw new Error('no mesh specified');
|
||||||
|
}
|
||||||
|
this.mesh = mesh;
|
||||||
|
|
||||||
switch (this.bodyType) {
|
switch (this.bodyType) {
|
||||||
case GameLib.CustomCode.BODY_TYPE_HEAD :
|
case GameLib.CustomCode.BODY_TYPE_HEAD :
|
||||||
|
@ -131,19 +134,17 @@ GameLib.CustomCode.SnakeBody = function(
|
||||||
mesh.updateInstance('rotation');
|
mesh.updateInstance('rotation');
|
||||||
position.x += 1;
|
position.x += 1;
|
||||||
default :
|
default :
|
||||||
throw new Error('body type not specified and no mesh');
|
throw new Error('unreachable statement');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
this.mesh = mesh;
|
|
||||||
|
|
||||||
this.applyPositionToMesh();
|
this.applyPositionToMesh();
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
||||||
return new GameLib.CustomCode.SnakeBody(
|
return new GameLib.CustomCode.SnakeBody(
|
||||||
this.bodyType,
|
this.bodyType,
|
||||||
|
this.mesh,
|
||||||
{
|
{
|
||||||
x : this.position.x,
|
x : this.position.x,
|
||||||
y : this.position.y
|
y : this.position.y
|
||||||
|
@ -151,8 +152,7 @@ GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
||||||
{
|
{
|
||||||
x : this.direction.x,
|
x : this.direction.x,
|
||||||
y : this.direction.y
|
y : this.direction.y
|
||||||
},
|
}
|
||||||
this.mesh
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue