Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 588 bytes modified
parent
374ee2c16a
commit
561779f2bb
|
@ -228,6 +228,7 @@ GameLib.CustomCode.SnakeBody.prototype.advance = function(orientation) {
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
|
|
||||||
this.advanceTime += delta;
|
this.advanceTime += delta;
|
||||||
|
|
||||||
if (this.advanceTime > this.speed) {
|
if (this.advanceTime > this.speed) {
|
||||||
|
@ -249,14 +250,30 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
tail.position.y = parent.position.y;
|
tail.position.y = parent.position.y;
|
||||||
tail.orientation = parent.orientation;
|
tail.orientation = parent.orientation;
|
||||||
|
|
||||||
if (this.snake.length === 1) {
|
if (
|
||||||
|
this.snake.length === 1 &&
|
||||||
|
this.state.turning &&
|
||||||
|
parent.bodyType !== GameLib.CustomCode.BODY_TYPE_TAIL
|
||||||
|
) {
|
||||||
console.log('before head');
|
console.log('before head');
|
||||||
|
|
||||||
|
var corner = new GameLib.CustomCode.SnakeBody(
|
||||||
|
this.meshBreadCorner,
|
||||||
|
body.position,
|
||||||
|
body.orientation,
|
||||||
|
GameLib.CustomCode.BODY_TYPE_CORNER,
|
||||||
|
parent
|
||||||
|
);
|
||||||
|
|
||||||
|
this.state.turning = false;
|
||||||
|
|
||||||
|
corner.applyToMesh();
|
||||||
|
newSnake.unshift(corner);
|
||||||
|
} else {
|
||||||
|
tail.applyToMesh();
|
||||||
|
newSnake.unshift(tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail.applyToMesh();
|
|
||||||
|
|
||||||
newSnake.unshift(tail);
|
|
||||||
|
|
||||||
tail = parent;
|
tail = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue