Jump to content
  • Advertisement
Sign in to follow this  
GamDev

Tilemap collision nowadays

This topic is 2609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering, what collision method do people use nowadays on sidescrolling platformers? Is it pixel-perfect or rectangle box?

Share this post


Link to post
Share on other sites
Advertisement

I was wondering, what collision method do people use nowadays on sidescrolling platformers? Is it pixel-perfect or rectangle box?


I use neither. I usually have an array of int's for the tilemap, and then I do a four-corner overlap check, using the player's position divided by the tile size. I then check whether the index in the array at that position is a passable value or not.
The method is described in detail here:
http://www.parallelrealities.co.uk/

It works wonders and is blazing fast. The only drawback is all the tiles need to be the same size, without some manipulation to the code.

Share this post


Link to post
Share on other sites
A fast and easy approach is to use Binary space partioning, coupled with pixel collision. BSP is incredibly easy to integrate once you know how, and you won't need to refactor lots of code either.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!