Search code examples
androiddictionarylibgdxtmxtiled

LibGDX, Having problems with TMX map (rendering, resizing)


I'm making a new Android Game with LibGDX, a platformer but I'm having issues with TMX (Tiled) maps. I read a lot about tiles gaps problems with LibGDX but I can't make it work well.

Here is my problem: sometimes, when the character moves, I can see for on each tiles the end of the previous tile on the Tileset, in full screen on my computer it works well most of the time, but when I set the size of the window to the resolution of my smartphone (800x480px) that won't work.

Here's a video of this problem: https://www.youtube.com/watch?v=IXaoE_YNpuA&list=UUE3Ty03UMwTh3hNIKx2Dmmw

And here's my tileset: enter image description here

Have you got an idea about what can solve this problem ?


Solution

  • This is because of the blending that happens when you're scaling down the image (or rendering it at sub-pixel positions). To avoid it, you can add a 2-pixel spacing between your tiles and make sure the pixels in this space match the colour of the neighbouring tile edges.

    Alternatively, try to disable the blending, but I can't tell you how to do that in LibGDX.