Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 65 bytes modified
parent
40311bb233
commit
0b72479c81
|
@ -243,7 +243,7 @@ GameLib.CustomCode.prototype.waitReload = function(delta) {
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
5000
|
5000
|
||||||
);
|
);
|
||||||
|
|
||||||
window.setTimeout(
|
window.setTimeout(
|
||||||
function(){
|
function(){
|
||||||
this.state.message = "GO!";
|
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.constructor = GameLib.CustomCode.GameObject;
|
||||||
|
|
||||||
GameLib.CustomCode.SnakeBody.prototype.dispose = function() {
|
GameLib.CustomCode.SnakeBody.prototype.dispose = function() {
|
||||||
|
|
||||||
GameLib.CustomCode.GameObject.prototype.dispose.call(this);
|
GameLib.CustomCode.GameObject.prototype.dispose.call(this);
|
||||||
|
|
||||||
if (this.backupMesh) {
|
if (this.backupMesh) {
|
||||||
this.backupMesh.geometry = null;
|
this.backupMesh.geometry = null;
|
||||||
this.backupMesh.materials = null;
|
this.backupMesh.materials = null;
|
||||||
|
@ -1152,7 +1154,7 @@ GameLib.CustomCode.prototype.createCorner = function(body, temp) {
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.backup = function() {
|
GameLib.CustomCode.prototype.backup = function() {
|
||||||
|
|
||||||
this.backup = {
|
this.backupState = {
|
||||||
snake : this.snake.map(
|
snake : this.snake.map(
|
||||||
function(body) {
|
function(body) {
|
||||||
return body.clone();
|
return body.clone();
|
||||||
|
@ -1178,7 +1180,7 @@ GameLib.CustomCode.prototype.restore = function() {
|
||||||
var meshFound = false;
|
var meshFound = false;
|
||||||
var backupMeshFound = false;
|
var backupMeshFound = false;
|
||||||
|
|
||||||
this.backup.snake.map(
|
this.backupState.snake.map(
|
||||||
function (backupBody) {
|
function (backupBody) {
|
||||||
if (
|
if (
|
||||||
body.mesh === backupBody.mesh ||
|
body.mesh === backupBody.mesh ||
|
||||||
|
@ -1222,15 +1224,15 @@ GameLib.CustomCode.prototype.restore = function() {
|
||||||
/**
|
/**
|
||||||
* Restore our backup
|
* Restore our backup
|
||||||
*/
|
*/
|
||||||
this.state.orientation = this.backup.orientation;
|
this.state.orientation = this.backupState.orientation;
|
||||||
this.state.flip = this.backup.flip;
|
this.state.flip = this.backupState.flip;
|
||||||
this.snake = this.backup.snake.map(
|
this.snake = this.backupState.snake.map(
|
||||||
function(body) {
|
function(body) {
|
||||||
|
|
||||||
var clone = body.clone();
|
var clone = body.clone();
|
||||||
|
|
||||||
clone.applyToMesh();
|
clone.applyToMesh();
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
@ -1287,7 +1289,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
|
|
||||||
body.mesh.updateInstance('position');
|
body.mesh.updateInstance('position');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
|
|
||||||
backup = {
|
backup = {
|
||||||
|
@ -1308,11 +1310,11 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
||||||
this.grid[backup.position.x][backup.position.y] = new GameLib.CustomCode.GameObject();
|
this.grid[backup.position.x][backup.position.y] = new GameLib.CustomCode.GameObject();
|
||||||
|
|
||||||
if (!advanced) {
|
if (!advanced) {
|
||||||
|
|
||||||
this.explode(body.position);
|
this.explode(body.position);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var gameObject = this.grid[body.position.x][body.position.y];
|
var gameObject = this.grid[body.position.x][body.position.y];
|
||||||
|
|
||||||
switch (gameObject.objectType) {
|
switch (gameObject.objectType) {
|
||||||
|
|
Loading…
Reference in New Issue