final touches

This commit is contained in:
Cameron Smart
2020-04-26 00:42:22 -07:00
parent b557111ab7
commit a91a0f4a73
14 changed files with 132 additions and 67 deletions

View File

@@ -43,8 +43,10 @@ class Dungeon(object):
center = "resources/levels/map1/center.json"
self.levels = [
[Level.load_file(x, y, center) for y in range(size)] for x in range(size)
[Level.load_file(x, y) for y in range(size)] for x in range(size)
]
print('--------------------------------------------------')
print(self.levels)
self.matrix = [[1 for yy in range(size * 10)] for xx in range(10 * size)]
for column in self.levels:
for level in column:
@@ -125,7 +127,7 @@ class Level:
self.wall_list = []
@staticmethod
def load_file(level_x: int, level_y: int, path: str) -> Level:
def load_file(level_x: int, level_y: int) -> Level:
"""
Builds a Level from a given file path.
@@ -135,6 +137,8 @@ class Level:
:return: The new generated Level file.
"""
path = f'resources/levels/map1/{random.randint(1, 9)}.json'
level = Level(level_x, level_y)
with open(path) as file:
data = json.load(file)