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

beta.r3js.org
-=yb4f310 2018-03-15 13:16:43 +01:00
parent 374ee2c16a
commit 561779f2bb
1 changed files with 23 additions and 6 deletions

View File

@ -228,6 +228,7 @@ GameLib.CustomCode.SnakeBody.prototype.advance = function(orientation) {
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
this.advanceTime += delta;
if (this.advanceTime > this.speed) {
@ -249,14 +250,30 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
tail.position.y = parent.position.y;
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');
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;
}