I have been working on a KidsCanCode project in pygame(https://www.youtube.com/watch?v=3UxnelT9aCo&list=PLsk-HSGFjnaGQq7ybM8Lgkh5EMxUWPm2i) and I've finished everything. Now I'm trying to create levels by loading two different tiled formats, but only one will load. Even if I try just loading 'level2.tmx', it won't work. Here is the code:
main.py https://drive.google.com/file/d/1deCK3QED_e8uE4oRRECtizgTFMLvwbKN/view?usp=sharing
settings.py https://drive.google.com/file/d/1LvhnJCobweFT462PPXY42_FdnSF2UGs2/view?usp=sharing
sprites.py https://drive.google.com/file/d/1FD-Uj2SjMVNG29IcK5qaLoU6RBIB5I1s/view?usp=sharing
tilemap.py https://drive.google.com/file/d/1JeYiEo-xJHJ0I16geg7jNERAC5pqEIIH/view?usp=sharing
(By the way, in main.py(load_data), when it says to load tiled1.tmx, it should say level2.tmx.)
The error is this:
TMX compression type: zstd is not supported.
cannot load
done
It still loads level1.tmx, and the game goes on normally, but I cannot load level2.tmx, and if I try loading that to play, the screen does not load and it gives an error:
TMX compression type: zstd is not supported.
Traceback (most recent call last):
File "C:\Users\ruben\Documents\MAX\Python\Pygame\tileyLevel\main.py", line 285, in <module>
g.new()
File "C:\Users\ruben\Documents\MAX\Python\Pygame\tileyLevel\main.py", line 120, in new
self.map = TiledMap(path.join(self.map_folder, 'level2.tmx'))
File "C:\Users\ruben\Documents\MAX\Python\Pygame\tileyLevel\tilemap.py", line 22, in __init__
tm = pytmx.load_pygame(filename, pixelalpha=True)
File "C:\Users\ruben\AppData\Local\Programs\Python\Python38\lib\site-packages\pytmx\util_pygame.py", line 141, in load_pygame
return pytmx.TiledMap(filename, *args, **kwargs)
File "C:\Users\ruben\AppData\Local\Programs\Python\Python38\lib\site-packages\pytmx\pytmx.py", line 360, in __init__
self.parse_xml(ElementTree.parse(self.filename).getroot())
File "C:\Users\ruben\AppData\Local\Programs\Python\Python38\lib\site-packages\pytmx\pytmx.py", line 391, in parse_xml
self.add_layer(TiledTileLayer(self, subnode))
File "C:\Users\ruben\AppData\Local\Programs\Python\Python38\lib\site-packages\pytmx\pytmx.py", line 962, in __init__
self.parse_xml(node)
File "C:\Users\ruben\AppData\Local\Programs\Python\Python38\lib\site-packages\pytmx\pytmx.py", line 1044, in parse_xml
raise Exception
Exception
If someone can help me, that would be great. Thanks!
The error indicates that the file, level2.tmx, is compressed with compression type zstd. This kind of compression is not supported by your python install.
If you install a python module to handle this kind of compression, such as the module at: https://pypi.org/project/zstd/ It might work.
Alternatively you need to convert level2.tmx to the same format as level1.tmx