From e49a84b478827dbab1b2cc4fd1e560e6bdc71e18 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sun, 18 Feb 2018 15:19:35 +0100 Subject: [PATCH] Update: CC - Bacon - Entity Loaded (2xswm1bwq8.js) 102 bytes modified --- 2xswm1bwq8.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/2xswm1bwq8.js b/2xswm1bwq8.js index fbe4886..4758d1f 100644 --- a/2xswm1bwq8.js +++ b/2xswm1bwq8.js @@ -1504,7 +1504,7 @@ GameLib.CustomCode.prototype.stopBlock = function() { GameLib.CustomCode.prototype.endGame = function() { - GameLib.Event.Emit( + GameLib.Event.Emit( GameLib.Event.GAME_OVER, { score: this.score, @@ -1526,19 +1526,17 @@ GameLib.CustomCode.prototype.clearGrid = function() { */ if (this.grid instanceof Array) { this.grid.map( - function(y) { - if (this.grid[y] instanceof Array) { - this.grid[y].map( - function(x){ - if (this.grid[y][x].mesh) { - this.scene.removeObject(this.grid[y][x].mesh); - } - if (this.grid[y][x].baconDisappearing) { - this.scene.removeObject(this.grid[y][x].baconDisappearing); - } - }.bind(this) - ) - } + function(row) { + row.map( + function(block){ + if (block.mesh) { + this.scene.removeObject(block.mesh); + } + if (block.baconDisappearing) { + this.scene.removeObject(block.baconDisappearing); + } + }.bind(this) + ) }.bind(this) ) } @@ -1551,8 +1549,9 @@ GameLib.CustomCode.prototype.clearGrid = function() { this.grid[y] = []; for (var x = 0; x < GameLib.CustomCode.TETRIS_GRID_WIDTH; x++) { this.grid[y][x] = { - value: GameLib.CustomCode.TETRIS_GRID_NOT_TAKEN, - mesh: null + value : GameLib.CustomCode.TETRIS_GRID_NOT_TAKEN, + mesh : null, + baconDisappearing : null }; } }