03 - Really draw the map and initialize it at each new generation
This commit is contained in:
parent
5e06fdb3df
commit
8c0c26e7a8
1 changed files with 6 additions and 2 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue