Jan-05-2020, 10:44 AM
Thank you a lot. It works now.
I know that the TiledMap class I made is just for loading orthogonal maps.
How do I have to change this code, that I can load isometric maps?
Piethon
I know that the TiledMap class I made is just for loading orthogonal maps.
How do I have to change this code, that I can load isometric maps?
class TiledMap: def __init__(self, filename): tm = pytmx.load_pygame(filename, pixelalpha=True) self.width = tm.width * tm.tilewidth self.height = tm.height * tm.tileheight self.tmxdata = tm def render(self, surface): ti = self.tmxdata.get_tile_image_by_gid for layer in self.tmxdata.visible_layers: if isinstance(layer, pytmx.TiledTileLayer): for x, y, gid, in layer: tile = ti(gid) if tile: surface.blit(tile, (x * self.tmxdata.tilewidth, y * self.tmxdata.tileheight)) def make_map(self): temp_surface = pg.Surface((self.width, self.height)) self.render(temp_surface) return temp_surfaceI don't have much experience with pytmx, so I don't know, what I can change, that it is able to load isometric maps. Thanks for your help guys. :-)
Piethon