|
@@ -104,8 +104,15 @@ class TMXMap(object):
|
104
|
104
|
def tileset(self, name: str) -> tmx.Tileset:
|
105
|
105
|
return self.tmx_tilesets[name]
|
106
|
106
|
|
107
|
|
- def tile(self, gid: int) -> XYZTile:
|
108
|
|
- return self.tmx_tiles[gid]
|
|
107
|
+ def tile(self, gid: int, allow_default_tile: bool=False, default_tile: tmx.LayerTile=None) -> XYZTile:
|
|
108
|
+ try:
|
|
109
|
+ return self.tmx_tiles[gid]
|
|
110
|
+ except KeyError:
|
|
111
|
+ if default_tile:
|
|
112
|
+ return default_tile
|
|
113
|
+ if allow_default_tile:
|
|
114
|
+ return self.get_default_tile()
|
|
115
|
+ raise
|
109
|
116
|
|
110
|
117
|
def layer_tiles(self, name: str) -> typing.Dict[str, XYZTile]:
|
111
|
118
|
return self.tmx_layer_tiles[name]
|