Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 342 bytes modified
parent
173dc5c865
commit
102b6070a3
|
@ -236,37 +236,29 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.advanceTime += delta;
|
var tail = this.snake.pop();
|
||||||
|
var parent = null;
|
||||||
|
|
||||||
if (this.advanceTime > this.speed) {
|
var newSnake = [];
|
||||||
this.advanceTime = 0;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tail = this.snake.pop();
|
while (this.snake.length > 0) {
|
||||||
var parent = null;
|
|
||||||
|
|
||||||
var newSnake = [];
|
|
||||||
|
|
||||||
while (this.snake.length > 0) {
|
|
||||||
|
|
||||||
parent = this.snake.pop();
|
|
||||||
|
|
||||||
tail.position.x = parent.position.x;
|
|
||||||
tail.position.y = parent.position.y;
|
|
||||||
tail.orientation = parent.orientation;
|
|
||||||
|
|
||||||
tail.applyToMesh();
|
parent = this.snake.pop();
|
||||||
|
|
||||||
newSnake.push(tail);
|
tail.position.x = parent.position.x;
|
||||||
|
tail.position.y = parent.position.y;
|
||||||
tail = parent;
|
tail.orientation = parent.orientation;
|
||||||
}
|
|
||||||
|
tail.applyToMesh();
|
||||||
this.snake = newSnake;
|
|
||||||
|
newSnake.push(tail);
|
||||||
return;
|
|
||||||
|
tail = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.snake = newSnake;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
this.snake = this.snake.map(
|
this.snake = this.snake.map(
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue