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

beta.r3js.org
-=yb4f310 2018-03-15 12:59:50 +01:00
parent 1e2f98c6a0
commit f7c4748622
1 changed files with 30 additions and 0 deletions

View File

@ -236,6 +236,36 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
return;
}
this.advanceTime += delta;
if (this.advanceTime > this.speed) {
this.advanceTime = 0;
} else {
return;
}
var tail = this.snake.pop();
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;
newSnake.push(tail);
tail = parent;
}
this.snake = newSnake;
return;
this.snake = this.snake.map(
function(body, index) {