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

beta.r3js.org
-=yb4f310 2018-03-15 15:24:56 +01:00
parent 18ed18831a
commit 5b5d220944
1 changed files with 8 additions and 6 deletions

View File

@ -245,17 +245,17 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
if (index === 0) {
body.advance(
this.state.orientation
);
backup = {
backup = {
position : {
x : body.position.x,
y : body.position.y
},
orientation : body.orientation
}
body.advance(
this.state.orientation
);
}
if (index > 0) {
@ -284,13 +284,15 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
body.mesh.remove();
body.mesh = body.backupMesh;
body.backupMesh = null;
body.mesh.visible = true;
body.mesh.updateInstance('visible');
}
if (body.orientation !== backup.orientation) {
if (body.orientation !== this.snake[index-1].orientation) {
/**
* Our orientation changed - we should make a corner
*/