Tilemap collision nowadays

Started by
1 comment, last by ravinDavin 12 years, 5 months ago
I was wondering, what collision method do people use nowadays on sidescrolling platformers? Is it pixel-perfect or rectangle box?
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.
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.

This topic is closed to new replies.

Advertisement