Skip to main content
GameDev.net gamedev.net
🔒 Locked

Tilemap collision nowadays

Started by GamDev Oct 19, 2011 at 8:17 PM 1 replies 1.3k views
Original Post
GamDev
GamDev
I was wondering, what collision method do people use nowadays on sidescrolling platformers? Is it pixel-perfect or rectangle box?
KellerHood
KellerHood

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.
ravinDavin
ravinDavin
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.