I made a small piece of the map and was able to open it when the absolute path was indicated, I tried to put … before the path in the files, as I understand it, the working directory is indicated, but nothing works.
the directory looks like this:
gentle forest (size 48x48) v01.png
from pathlib import Path
from pytmx.util_pygame import load_pygame
class Background: def __init__(self, filename, x=0, y=0): self.map = Path('map', filename) self.x = x self.y = y def draw(self, camera, screen): map_data = load_pygame(self.map) for layer in map_data: for tile in layer.tiles(): x_pixel = tile * 48 + self.x y_pixel = tile * 48 + self.y screen.blit(tile, (-camera.rect + x_pixel, -camera.rect + y_pixel))
As soon as I didn’t try to write the path in the files, please help)