接下来,继续进行T3DLIB1剩余部分
,倒着进行,先进行bob碰撞检测
int DDraw_BOB::Collision_BOBS(BOB_PTR bob1, BOB_PTR bob2)
{
if( ! bob1 || !bob2 )
return 0;
int width1 = ( bob1->width >> 1 ) - ( bob1->width >> 3 );
int height1 = ( bob1->height >> 1 ) - ( bob1->height >> 3 );
int width2 = ( bob2->width >> 1 ) - ( bob2->width >> 3 );
int height2 = ( bob2->height >> 1 ) - ( bob2->height >> 3 );
int cx1 = bob1->x + width1;
int cy1 = bob1->y + height1;
int cx2 = bob2->x + width2;
int cy2 = bob2->y + height2;
int dx = abs( cx2 - cx1 );
int dy = abs( cy2 - cy1 );
if( dx < ( width1 + width2 ) && dy < ( height1 + height2 ) )
return 1;
else
return 0;
}