Feb-19-2020, 04:33 PM
...and once I actually woke up, I realized all that math can be based entirely off the indices, instead of having temporary variables. And also, that the tiles needed to be rotated 45 degrees:
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: x_offset = (WIDTH / 2) + (self.tmxdata.tilewidth / 2 * (x+1)) - (self.tmxdata.tilewidth / 2 * (y+1)) y_offset = ((y+1) * self.tmxdata.tileheight) + (self.tmxdata.tileheight * x) tile = ti(gid) if tile: rotated = pg.transform.rotate(tile.convert_alpha(), 45) surface.blit(rotated, (x_offset, y_offset))