As many people recommended, I am using Tiled map editor to create a map for my game and it's great particularly because libgdx framework also provides with API for maps from Tiled.

I understand I can define collidable tiles or not in the map editor so I can deal with any collision in my code. But I am currently in a situation that I need to divide a tile into a collidable and non-collidable areas. Manually, I think I can define points and lines of bounds of the two areas and programmatically deal with it. But that's a lot of time-consuming work.

So I googled a lot and found this physics-body editor. This seems like a great tool to automate the process I mentioned above. The system, however, works with each of unpacked image and I am not sure it would work even if I unpack the image for its operation.

I wonder if there is any better way to do this whole process of defining collision area. Any suggestion will be much appreciated.


1 Answer 1


As usual I'll just throw a few ideas to the table. There are certainly several ways you can approach this problem. I'll describe the three I managed to remember, and it's up to you to decide which (if any) of these approaches is good for your project.

Idea 1: Repeatable patterns in your tiles

Does your system need to be flexible enough to support any conceivable collision area, or can you possibly break it down into a finite set of tile shapes that you can build with, and treat them as special cases? Here's a pair of resources to read up on this idea:

Idea 2: Ignore the tilemap

Yes, ignore the tilemap completly, and store a different, polygonal representation of your collision area. Then overlay this geometry on top of your tile based map, and handle collisions with it. If you don't need any physics, check the following resource:

Otherwise, I think you could probably use the tool you linked to.

Idea 3: Pixel perfect collision detection

Use pixel perfect collisions and use a separate mask or just the alpha channel in your tiles to encode your variable collision areas. For inspiration, check the following guide:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .