Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 18 down vote accepted

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:

share|improve this answer
Another amazing answer! Thanks a lot. –  Paul Jan 12 '12 at 22:31
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.