我一直在寻找这个几个小时,无济于事。基本上我有错误:以临时地址[-fpermissive]
struct rectangle {
int x, y, w, h;
};
rectangle player::RegionCoordinates() // Region Coord
{
rectangle temp;
temp.x = colRegion.x + coordinates.x;
temp.w = colRegion.w;
temp.y = colRegion.y + coordinates.y;
temp.h = colRegion.h;
return temp;
}
// Collision detect function
bool IsCollision (rectangle * r1, rectangle * r2)
{
if (r1->x < r2->x + r2->w &&
r1->x + r1->w > r2->x &&
r1->y < r2->y + r2->h &&
r1->y + r1->h > r2->y)
{
return true;
}
return false;
}
//blah blah main while loop
if (IsCollision(&player1.RegionCoordinates(), &stick1.RegionCoordinates())) //ERROR
{
player1.score+=10;
stick1.x = rand() % 600+1;
stick1.y = rand() % 400+1;
play_sample(pickup,128,128,1000,false);
}
任何想法?我相信这是非常明显的事情,但对于我来说,我无法弄清楚。
RegionCaordinates()是什么签名? – Angew 2013-05-10 11:45:01
大声笑我做到了,我的不好 – 2013-05-10 11:53:31