Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help me please #16

Open
RouaHabibi opened this issue Feb 11, 2024 · 1 comment
Open

help me please #16

RouaHabibi opened this issue Feb 11, 2024 · 1 comment

Comments

@RouaHabibi
Copy link

I keep running into this problem and I think its because of the Mac paths but I don't know how to fix it, please help ,

File "/Users/mac/Desktop/ISS1/code/main.py", line 30, in
game = Game()
^^^^^^
File "/Users/mac/Desktop/ISS1/code/main.py", line 15, in init
self.level = Level()
^^^^^^^
File "/Users/mac/Desktop/ISS1/code/level.py", line 22, in init
self.create_map()
File "/Users/mac/Desktop/ISS1/code/level.py", line 41, in create_map
self.player = Player((1000,1000),[self.visible_sprites],self.obstacle_sprites)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mac/Desktop/ISS1/code/player.py", line 13, in init
self.import_player_assets()
File "/Users/mac/Desktop/ISS1/code/player.py", line 35, in import_player_assets
self.animations[animation] = import_folder(full_path)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mac/Desktop/ISS1/code/support.py", line 19, in import_folder
image_surf = pygame.image.load(full_path).convert_alpha()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pygame.error: Unsupported image format

thank you

@Eri-py
Copy link

Eri-py commented Feb 14, 2024

you pathLib and get the parent file path then merge. I did all mine in a settings file:

main_dir = Path(file).resolve().parent
background_1_dir = os.path.join(main_dir, r"Graphics\background\ground.png")

then when loading image, use the background_1_dir, hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants