From 5fbb9181320e3bf742a706639a303da2d8e6fc22 Mon Sep 17 00:00:00 2001 From: Charles Peyrat Date: Fri, 18 Dec 2020 17:05:50 +0100 Subject: [PATCH] Add walls even to map borders --- squirrelbattle/mapgeneration/randomwalk.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/squirrelbattle/mapgeneration/randomwalk.py b/squirrelbattle/mapgeneration/randomwalk.py index 32ec0d6..3acb58a 100644 --- a/squirrelbattle/mapgeneration/randomwalk.py +++ b/squirrelbattle/mapgeneration/randomwalk.py @@ -111,5 +111,13 @@ class Generator: result.tiles[y][x] = Tile.FLOOR elif c > 0: result.tiles[y][x] = Tile.WALL + for x in range(width): + for y in [0, height-1]: + if grid[y][x] = Tile.FLOOR: + grid[y][x] = Tile.WALL + for y in range(height): + for y in [0, width-1]: + if grid[y][x] = Tile.FLOOR: + grid[y][x] = Tile.WALL return result