Part 2.
This commit is contained in:
37
tile_types.py
Normal file
37
tile_types.py
Normal file
@@ -0,0 +1,37 @@
|
||||
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)),
|
||||
)
|
||||
Reference in New Issue
Block a user