- @classmethod
- def image(cls):
- if cls.IMG is None:
- raise NotImplementedError()
-
- return images.load(cls.IMG)
-
-class RandomizedTile(Tile):
- IMGDIR = None
-
- @classmethod
- def image(cls):
- if cls.IMGDIR is None:
- raise NotImplementedError()
-
- imgdir = os.path.join(os.path.dirname(__file__), '..', 'images', cls.IMGDIR)
- img = os.path.splitext(random.choice(os.listdir(imgdir)))[0]
-
- return images.load(os.path.join(cls.IMGDIR, img))
-
-class Floor(RandomizedTile):
- IMGDIR = "floor"
-
-class Wall(RandomizedTile):
- IMGDIR = "wall"