Files
RLD_CT/tile_types.py
2021-05-26 16:36:59 -04:00

37 lines
776 B
Python

from typing import Tuple
import numpy as np
graphic_dt = np.dtype(
[
("ch", np.int32),
("fg", "3b"),
("bg", "3B"),
]
)
tile_dt = np.dtype(
[
("walkable", np.bool),
("transparent", np.bool),
("dark", graphic_dt),
]
)
def new_tile(
*,
walkable: int,
transparent: int,
dark: Tuple[int, Tuple[int, int, int], Tuple[int, int, int]],
) -> np.ndarray:
"""Helper function for defining individual tile types"""
return np.array((walkable, transparent, dark), dtype=tile_dt)
floor = new_tile(
walkable=True, transparent=True, dark=(ord(" "),(255,255,255), (50,50, 150)),
)
wall = new_tile(
walkable=False, transparent=True, dark=(ord(" "), (255,255,255), (0,0,100)),
)