What do I do after the bounding box test against a tile to see ifdetermine whether there is a real collision against the contents of that tile? And if there is, how should I move the object in response to that collision?
I have a small object, and test for collisions against the tiles that each corner of it is on.
Here's my current code, which I run for each of those (up to) four tiles:
// i have a small object.. i test it vsget the 4 tiles that eachbounding cornerbox of it is
// on to see ifthe thereobject, isin aworld collision...space
// _1x1 and _1y1 andobjectBounds so= onobject->bounds are+ setobject->position; to the
if Object( 1(objectBounds.right x>= andtileBounds.left) y&& coordinates
// _2x1[i] and _2y1[i] and so on are set(objectBounds.left to<= thetileBounds.right) Tiles&& coordinates
if ((_1x2 >= _2x1[i]) && (_1x1objectBounds.top <=>= _2x2[i]tileBounds.bottom) &&
(_1y2 >= _2y1[i]) && (_1y1objectBounds.bottom <= _2y2[i]tileBounds.top))
{
// perform specific test to see if it's a left, top , bottom
// or right collision. If so, I check to see the nature of it
// and where I need to place the object... [this isto therespond partto that collision...
// needs[THIS work]IS THE PART THAT NEEDS WORK]
//
if(lastkey==keydown[right]&& lastkey==keydown[right] && ((_1x2objectBounds.right >= _2x1[i]tileBounds.left) &&
(_1x2objectBounds.right <= _2x2[i]tileBounds.right) &&
(_1y1objectBounds.bottom >= _2y1[i]tileBounds.bottom) && (_1y1
<= _2y2[i])))
{
currentobject1_ptr->xpos = _2x1[i]-(currentobject1_ptr->boundingmap ->width );
gamechar_x =newgc1= currentobject1_ptr->xpos - -mapooffset_x;
(objectBounds.bottom <= tileBounds.top)) gamechar_y)
= newgamechar_y = oldgamechar_y;{
rightstopobject->position.x = =1;tileBounds.left - objectBounds.width;
}
// etc.