Add a map shroud over tiles and compute field of view based on player position!!!

This commit is contained in:
Eryn Wells 2022-05-04 09:22:40 -07:00
parent 25aa5506c8
commit 084385f8f2
3 changed files with 51 additions and 7 deletions

View file

@ -20,11 +20,26 @@ tile_datatype = np.dtype([
('transparent', np.bool),
# A graphic struct (as above) defining the look of this tile when it's not visible
('dark', graphic_datatype),
# A graphic struct (as above) defining the look of this tile when it's visible
('light', graphic_datatype),
])
def tile(*, walkable: int, transparent: int, dark: Tuple[int, Tuple[int, int, int], Tuple[int, int ,int]]) -> np.ndarray:
return np.array((walkable, transparent, dark), dtype=tile_datatype)
def tile(*,
walkable: int,
transparent: int,
dark: Tuple[int, Tuple[int, int, int], Tuple[int, int ,int]],
light: Tuple[int, Tuple[int, int, int], Tuple[int, int ,int]]) -> np.ndarray:
return np.array((walkable, transparent, dark, light), dtype=tile_datatype)
Empty = tile(walkable=False, transparent=False, dark=(ord(' '), (255, 255, 255), (0, 0, 0)))
Floor = tile(walkable=True, transparent=True, dark=(ord(' '), (255, 255, 255), (50, 50, 150)))
Wall = tile(walkable=False, transparent=False, dark=(ord(' '), (255, 255, 255), (0, 0, 150)))
# An overlay color for tiles that are not visible and have not been explored
Shroud = np.array((ord(' '), (255, 255, 255), (0, 0, 0)), dtype=graphic_datatype)
Empty = tile(walkable=False, transparent=False,
dark=(ord(' '), (255, 255, 255), (0, 0, 0)),
light=(ord(' '), (255, 255, 255), (0, 0, 0)))
Floor = tile(walkable=True, transparent=True,
dark=(ord('·'), (80, 80, 100), (50, 50, 50)),
light=(ord('·'), (100, 100, 120), (80, 80, 100)))
Wall = tile(walkable=False, transparent=False,
dark=(ord(' '), (255, 255, 255), (0, 0, 150)),
light=(ord(' '), (255, 255, 255), (50, 50, 200)))