From 8c0c26e7a83763aba39126b227c329d1c4de3a58 Mon Sep 17 00:00:00 2001 From: kleph Date: Wed, 7 Dec 2016 01:38:58 +0100 Subject: [PATCH] 03 - Really draw the map and initialize it at each new generation --- 03_map.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/03_map.py b/03_map.py index 2ce1993..d3fef95 100644 --- a/03_map.py +++ b/03_map.py @@ -144,7 +144,7 @@ class Level: def __init__(self, sizex, sizey, tile_file=None): self.sizex, self.sizey = sizex, sizey self.tileset = [] - self.tilemap = [[self.TILE_ROAD for y in range(0, sizey)] for x in range(0, sizex)] + self.tilemap = [] if tile_file: self.load_tileset(tile_file) self.tree = self.generate_tree() @@ -170,6 +170,9 @@ class Level: tree.append(l.left_leaf) tree.append(l.right_leaf) + #initialize tilemap with road/ground + self.tilemap = [[self.TILE_ROAD for y in range(0, self.sizey)] for x in range(0, self.sizex)] + # create rooms from partitions tree[0].generate_rooms(self.tilemap) return tree @@ -229,7 +232,8 @@ def on_key_press(symbol, modifiers): @window.event def on_draw(): window.clear() - level.draw_tree() + #level.draw_tree() + level.draw_map() label.draw()