Closed xivol closed 3 years ago
load tsx only
i don't test using pytmx like this, its meant to be used with the parent class and image loader.
deserialize tsx animations from filename
idk what this is supposed to mean, sorry. the tile animations are stored in the tile properties dictionary. if you want to get the animations from a tileset, you can find them by following this section of the readme:
https://github.com/bitcraft/pytmx#getting-tile-animations
pytmx by default won't load tiles unless they are used in a layer somewhere. you can avoid this by passing load_all_tiles=True
to the loader
from pytmx.util_pygame import load_pygame
tiled_map = load_pygame(path_to_tmx_file, load_all_tiles=True)
there isn't a more direct way of getting animations from the tileset, currently.
Thank you. load_all argument is what I was looking for! I created tmx file with associated tileset, and it works!
The only problem I've encountered is with empty layer. Tiled allows to add layers with no data. pytmx crashes on empty data:
<layer id="1" name="Tile Layer 1" width="1" height="1">
<data encoding="csv"/>
</layer>
It's easely fixed by adding any tile id into the data. But maybe it should be considered an Exception.
Thanks for letting me know about the crash with an empty layer. I’ll get that fixed! Glad it’s working for you.
On Fri, Apr 9, 2021 at 8:56 AM Ilya Loshkarev @.***> wrote:
Closed #142 https://github.com/bitcraft/pytmx/issues/142.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/bitcraft/pytmx/issues/142#event-4574597667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEH5J2TA45WNSSULIKVZSLTH4BRTANCNFSM42USYIDA .
Another bug I found:
TiledImageLayer.parse_xml
self.visible = node.get('visible', self.visible)
gives youself.visible, <class 'str'>, 0
. So the result is always visible.
Not a big issue for ImageLayers, but still.
i agree it should be fixed, thanks for letting me know
I was trying to figure a simple way to store animated sprites without writing my own serializer.
I see that pytmx supports animated tiles and external tsx load. But is there a way to deserialize tsx animations from filename? I tried TiledTileset, but it skips over individual tiles and animations: