Hello, I’m using TiledMapRenderer, which is displaying static tiles just fine. However, when it tries to render an animated tile, it appears the source rectangle’s top left coordinate is always 0, 0, while the bottom right coordinate is correct. So instead of seeing each individual frame, I’m seeing all tiles from the top left of the texture to the current frame crammed into the destination rectangle. It is “animating” but the source rectangle just grows each frame until the animation restarts.
I am simply calling TiledMapRenderer.Draw(). Is there more to rendering animated tiles, or should that call be drawing them properly?
Sorry for the thread necromancy, but did this ever get a comment or resolution? I’ve looked and seen no one else referring to this issue and I couldn’t find anything in the github, although i could have missed it.
Error was lines 24 and 25 on TiledMapTileSetTileAnimationFrame.cs the (float) in front of sourceRectagnle.X and Y respectively wasn’t fixing the int division. It needs to be on the divisor apparently otherwise it gets set to 0.
Hi, this is a bit old, but still not fixed in the latest builds. I believe what Syrinth said is true, though I haven’t tried it, I just looked at the piece of code.
I wrote the original code. While annoying to look at between left and right operand being cast to float, it really doesn’t matter. The compiler understands that we want the result to be a float because the division operation with either the left or the right operand is a float. The code should work as expected if you are using master branch since May 28th 2018.