def __init__(self, layer, pytmx_tiled_map, id_, tile_props, rect):
"""
:param TiledTileLayer layer: the TiledTileLayer object to which this tile belongs
:param pytmx.pytmx.TiledMap pytmx_tiled_map: the tmx tiled-map object to which this tile belongs
(useful to have to look up certain map-side properties, e.g. tilewidth/height)
:param int id_: tthe ID of the tile in the layer
:param dict tile_props: the properties dict of this tile (values already translated into python types)
:param Union[pygame.Rect,None] rect: the pygame.Rect representing the position and size of the tile
"""
super().__init__(rect.x, rect.y, width_height=(rect.width, rect.height))
self.tiled_tile_layer = layer
self.pytmx_tiled_map = pytmx_tiled_map
self.tile = id_
self.tile_x = self.rect.x // self.pytmx_tiled_map.tilewidth
self.tile_y = self.rect.y // self.pytmx_tiled_map.tileheight
self.tile_props = tile_props
# add the `dockable` type to all tiles
self.type |= Sprite.get_type("dockable")
评论列表
文章目录