# Best collision detection system for specific game type

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

## Recommended Posts

Respected Game Gurus,

I have another thread going which is talking about collision detection and response for a 2D game. I was just wondering if I am using the best suited algorith for the type of game I want to make.

I am going to be working on a 2d tile-based adventure/platformer, there will be sloped platforms which I will need to handle along with ladders, moving enemies, water,...

I am starting to think that AABB's would be a better choice than SAT, also I think that I would rather implement continuous rather than discrete collision detection (as I am having problems with discrete SAT at the moment).

Thanks guys,
Mark.

##### Share on other sites
A very simple 2D algorithm is:

 location1 // Each location has 4 values, x, y, width and height location2 if(location1.getX >= location2.getX) { if(location1.getY >= location2.getY { if(location1.getX + location1.Width < location2.getX + location2.getWidth) { if(location1.getY + location1.Height < location2.getY + location2. height) { // Collision! return collision; } } } } // If we get this far we didn't detect collision // Run another check for ramps 

This is great because its very simple overlapping collision. Which will work for most of your game. However you'll need to use another algorithm to check for slopes. This can be done if the first check fails to save on processing time.

Alternatively just make your slope into smaller "blocks" which use the method above.

See link below for an example of the box / overlap collision.

[media]http://www.shockware.co.uk/games/lemi.jar[/media]

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633721
• Total Posts
3013534
×