Trash!!!
This commit is contained in:
19
Tileset.py
Normal file
19
Tileset.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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
|
||||
Reference in New Issue
Block a user