Files
test/Tileset.py
Christian ba21a28ec9 Trash!!!
2024-08-07 16:21:02 +02:00

20 lines
605 B
Python

import pygame
import Tiletype
import Utils
class TileSet(object):
def __init__(self, image, colorkey, tile_width, tile_height) -> None:
self.image = Utils.load_image(image, colorkey)
self.tile_width = tile_width
self.tile_height = tile_height
self.tile_types = dict()
def add_tile(self, name, start_x, start_y):
self.tile_types[name] = Tiletype.TileType(name, start_x, start_y, self.tile_width, self.tile_height)
def get_tile(self, name):
try:
return self.tile_types[name]
except KeyError:
return None