From a28dac4a46427d5dd50ba3ed7b404f88572f286f Mon Sep 17 00:00:00 2001 From: Xevion Date: Sat, 18 Apr 2020 02:58:55 -0500 Subject: [PATCH] add level/dungeon rendering methods, start planning out how positions are placed --- triple-dungeon/map.py | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/triple-dungeon/map.py b/triple-dungeon/map.py index b7145e9..beff019 100644 --- a/triple-dungeon/map.py +++ b/triple-dungeon/map.py @@ -6,6 +6,8 @@ Pathfinding will also depend on objects here, and is thus integral to it's funct from __future__ import annotations +import arcade + class Dungeon(object): """ @@ -23,6 +25,16 @@ class Dungeon(object): self.level_count, self.size = level_count, size self.levels = [[None for y in range(size)] for x in range(size)] # array[x][y] style access + def render(self) -> None: + """ + Calls render on all level + """ + + for column in self.levels: + for level in column: + if level is not None: + level.render() + class Level(object): """ @@ -31,8 +43,23 @@ class Level(object): """ - def __init__(self,) -> None: - self.wallGrid = [] + def __init__(self, level_x: int, level_y: int) -> None: + """ + Initializes the level class. Defaults with no sprites, and no background. + + :param level_x: The level's X position within the Dungeon level matrix. + :param level_y: The level's Y position within the Dungeon level matrix. + """ + + self.x, self.y = level_x, level_y + self.sprites = arcade.SpriteList() + + # Tuples containing the Node positions of where walls, air and entrances are. + # All positions are generated based on the level's X and Y position, so that all points within + # the dungeon can be mapped by a proper pathfinding system. + self.walls = [] + self.air = [] + self.entrances = [] @staticmethod def load_file(path: str) -> Level: @@ -43,3 +70,9 @@ class Level(object): :return: The new generated Level file. """ pass + + def render(self) -> None: + """ + Calls render on all sprites. + """ + pass \ No newline at end of file