Texture packs are working

This commit is contained in:
Yohann D'ANELLO
2020-11-06 17:43:30 +01:00
parent 4115363b74
commit f9dcc8f1c1
6 changed files with 61 additions and 38 deletions

View File

@@ -1,13 +1,34 @@
ascii_textures = {
"EMPTY" : ' ',
"WALL" : '#',
"FLOOR" : '.',
"PLAYER" : '@'
}
class TexturePack:
_packs = dict()
squirrel_textures = {
"EMPTY" : ' ',
"WALL" : '',
"FLOOR" : '.',
"PLAYER" : '🐿️'
}
name: str
EMPTY: str
WALL: str
FLOOR: str
PLAYER: str
def __init__(self, name: str, **kwargs):
self.name = name
self.__dict__.update(**kwargs)
TexturePack._packs[name] = self
@classmethod
def get_pack(cls, name: str) -> "TexturePack":
return cls._packs[name]
TexturePack.ASCII_PACK = TexturePack(
name="ascii",
EMPTY=' ',
WALL='#',
FLOOR='.',
PLAYER='@',
)
TexturePack.SQUIRREL_PACK = TexturePack(
name="squirrel",
EMPTY=' ',
WALL='',
FLOOR='.',
PLAYER='🐿️',
)