Here is my own collision detection which may help some people out. You first need an array of what ever you want to collide with, 1 is solid, 0 is not. Each number will represent a block. If TileSize = 32, the tiles are 32 by 32.
Collision:
if(CollisionDetection)
{
for(short h = 0; h <= (*m_pHeightCollisionBox); ++h)
{
for(short w = 0; w <= (*m_pWidthCollisionBox); ++w)
{
//The h and w offset is creating a collision box around the character
//WindowOffSet is pushing the screen down a bit for a HUD
if(OurMap[short((dbSpriteY(TheSprite) + h - WindowOffSet)/ TileSize)][short((dbSpriteX(TheSprite) + w)/ TileSize)])
{
return true;
}
}
} //end of World Collision
} // end of collision
Array:
const short OurMap[11][11] =
{{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0}};