Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 15 bytes modified
parent
ef0728e517
commit
c822aa11df
|
@ -191,12 +191,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
this.snake.map(
|
this.snake.map(
|
||||||
function(body, index) {
|
function(body, index) {
|
||||||
|
|
||||||
var tempPosition = {
|
|
||||||
x : body.position.x,
|
|
||||||
y : body.position.y
|
|
||||||
};
|
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
|
|
||||||
position.x = body.position.x;
|
position.x = body.position.x;
|
||||||
|
@ -205,11 +200,18 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
body.advance(this.direction, this.rotation);
|
body.advance(this.direction, this.rotation);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
var tempPosition = {
|
||||||
|
x : body.position.x,
|
||||||
|
y : body.position.y
|
||||||
|
};
|
||||||
|
|
||||||
body.position.x = position.x;
|
body.position.x = position.x;
|
||||||
body.position.y = position.y;
|
body.position.y = position.y;
|
||||||
|
|
||||||
position.x = tempPosition.x;
|
position.x = tempPosition.x;
|
||||||
position.y = tempPosition.y;
|
position.y = tempPosition.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.applyToMesh();
|
body.applyToMesh();
|
||||||
|
|
Loading…
Reference in New Issue