create dungeon matrix for pathfinding

This commit is contained in:
Xevion
2020-04-21 13:32:15 -05:00
parent 5b53a8e227
commit 1d88c6b985

View File

@@ -7,6 +7,8 @@ Pathfinding will also depend on objects here, and is thus integral to it's funct
from __future__ import annotations
import json
from pprint import pprint
import arcade
import numpy as np
@@ -40,6 +42,14 @@ class Dungeon(object):
self.levels = [
[Level.load_file(x, y, center) for y in range(size)] for x in range(size)
]
self.matrix = [[0 for yy in range(size * 10)] for xx in range(10 * size)]
for column in self.levels:
for level in column:
for xx in range(10):
for yy in range(10):
if level.structure[xx][yy] == 'w':
self.matrix[(level.x * 10) + xx][(level.y * 10) + yy] = 1
# pprint(self.matrix, width=1000)
def getWalls(self) -> arcade.SpriteList:
"""