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

beta.r3js.org
-=yb4f310 2018-03-24 11:15:13 +01:00
parent 40311bb233
commit 0b72479c81
1 changed files with 14 additions and 12 deletions

View File

@ -243,7 +243,7 @@ GameLib.CustomCode.prototype.waitReload = function(delta) {
}.bind(this),
5000
);
window.setTimeout(
function(){
this.state.message = "GO!";
@ -833,7 +833,9 @@ GameLib.CustomCode.SnakeBody.prototype = Object.create(GameLib.CustomCode.GameOb
GameLib.CustomCode.SnakeBody.prototype.constructor = GameLib.CustomCode.GameObject;
GameLib.CustomCode.SnakeBody.prototype.dispose = function() {
GameLib.CustomCode.GameObject.prototype.dispose.call(this);
if (this.backupMesh) {
this.backupMesh.geometry = null;
this.backupMesh.materials = null;
@ -1152,7 +1154,7 @@ GameLib.CustomCode.prototype.createCorner = function(body, temp) {
GameLib.CustomCode.prototype.backup = function() {
this.backup = {
this.backupState = {
snake : this.snake.map(
function(body) {
return body.clone();
@ -1178,7 +1180,7 @@ GameLib.CustomCode.prototype.restore = function() {
var meshFound = false;
var backupMeshFound = false;
this.backup.snake.map(
this.backupState.snake.map(
function (backupBody) {
if (
body.mesh === backupBody.mesh ||
@ -1222,15 +1224,15 @@ GameLib.CustomCode.prototype.restore = function() {
/**
* Restore our backup
*/
this.state.orientation = this.backup.orientation;
this.state.flip = this.backup.flip;
this.snake = this.backup.snake.map(
this.state.orientation = this.backupState.orientation;
this.state.flip = this.backupState.flip;
this.snake = this.backupState.snake.map(
function(body) {
var clone = body.clone();
clone.applyToMesh();
return clone;
}.bind(this)
);
@ -1287,7 +1289,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
body.mesh.updateInstance('position');
}
if (index === 0) {
backup = {
@ -1308,11 +1310,11 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
this.grid[backup.position.x][backup.position.y] = new GameLib.CustomCode.GameObject();
if (!advanced) {
this.explode(body.position);
} else {
var gameObject = this.grid[body.position.x][body.position.y];
switch (gameObject.objectType) {