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

Support for TMX animated tiles #283

Open
Freakus opened this issue Feb 15, 2017 · 1 comment
Open

Support for TMX animated tiles #283

Freakus opened this issue Feb 15, 2017 · 1 comment
Labels

Comments

@Freakus
Copy link

Freakus commented Feb 15, 2017

As Tiled supports animated tiles, it would be nice to have this supported in cocos.

I've been trying to work on adding this to the load_tmx() function myself by stepping through the relevant tags in the tileset and building AnimationFrames which can then be compiled into an Animation at the end and stored instead of the original tile image. However, I'm getting strange behaviour as the screen moves to show and away from such tiles repeatedly; specifically the animation's frame timings are all going wrong, switching frames at irregular intervals and I suspect some frames cycling so fast you can't even see them.

Here's the modified version of load_tmx() that resulted from my efforts: load_tmx.txt
You can clearly see the areas I've messed with as I've marked them with big begin/end butchery comments. (I was expecting it to be more involved than it was).

Note that whilst at it, I also threw in some code to handle map-level properties too.

@Freakus
Copy link
Author

Freakus commented Feb 15, 2017

I think I've found why the animations are appearing to go wrong. It seems that _update_sprite_set() in MapLayer isn't properly cleaning up the old sprites. I'm unsure of the exact issue involved but adding"self._sprites[k].delete()" just before the del statement appears to do the job nicely.

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

No branches or pull requests

2 participants