From: MegaBrutal Date: Mon, 24 Apr 2017 01:36:24 +0000 (+0200) Subject: Remove previous walls when new walls are created X-Git-Url: http://git.megabrutal.com/?a=commitdiff_plain;h=9bc05df28e7738352d7e73d03e545cc46282814d;p=ld38.git Remove previous walls when new walls are created modified: ld38.js --- diff --git a/ld38.js b/ld38.js index c5c6755..6e882be 100644 --- a/ld38.js +++ b/ld38.js @@ -179,6 +179,7 @@ newWorldStartY += (newWorldEndY - newWorldStartY) / 2; // Draw a wall around the new world bounds. + walls.removeAll(true); walls.add(game.add.tileSprite(newWorldStartX - WALL_THICKNESS, newWorldStartY - WALL_THICKNESS, newWorldEndX - newWorldStartX + WALL_THICKNESS * 2, WALL_THICKNESS, 'wall')); walls.add(game.add.tileSprite(newWorldStartX - WALL_THICKNESS, newWorldEndY, newWorldEndX - newWorldStartX + WALL_THICKNESS * 2, WALL_THICKNESS, 'wall')); walls.add(game.add.tileSprite(newWorldStartX - WALL_THICKNESS, newWorldStartY - WALL_THICKNESS, WALL_THICKNESS, newWorldEndY - newWorldStartY + WALL_THICKNESS * 2, 'wall'));