|
|

楼主 |
发表于 2005-2-24 17:10:00
|
显示全部楼层
Re:新手初来乍到~ 大家好啊~ 抛砖引玉~ 奉上自制小玩意儿
部分代码:
Color c1,c2;
// Iterate over all pixels of
// intersection rectangle
for (int i = 0; i < intersection.Width; i++)
{
for(int j = 0; j < intersection.Height; j++)
{
// Check color of current pixel
// for first and second object
c1=FirstObject_Bitmap.GetPixel(i + addX1 , j + addY1);
c2=SecondObject_Bitmap.GetPixel(i + addX2 , j + addY2);
if (c1 != TransparencyColor && c2 != TransparencyColor)
{
// Check collision direction
CheckDirection(FirstObject,
SecondObject,
ref FirstToSecondX,
ref FirstToSecondY);
// Collision found
return true;
}
}
}
|
|