mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-10 10:05:22 -06:00
add level/dungeon rendering methods, start planning out how positions are placed
This commit is contained in:
@@ -6,6 +6,8 @@ Pathfinding will also depend on objects here, and is thus integral to it's funct
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import arcade
|
||||||
|
|
||||||
|
|
||||||
class Dungeon(object):
|
class Dungeon(object):
|
||||||
"""
|
"""
|
||||||
@@ -23,6 +25,16 @@ class Dungeon(object):
|
|||||||
self.level_count, self.size = level_count, size
|
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
|
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):
|
class Level(object):
|
||||||
"""
|
"""
|
||||||
@@ -31,8 +43,23 @@ class Level(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,) -> None:
|
def __init__(self, level_x: int, level_y: int) -> None:
|
||||||
self.wallGrid = []
|
"""
|
||||||
|
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
|
@staticmethod
|
||||||
def load_file(path: str) -> Level:
|
def load_file(path: str) -> Level:
|
||||||
@@ -43,3 +70,9 @@ class Level(object):
|
|||||||
:return: The new generated Level file.
|
:return: The new generated Level file.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def render(self) -> None:
|
||||||
|
"""
|
||||||
|
Calls render on all sprites.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user