mohammadali1375
چهارشنبه 27 دی 1391, 23:13 عصر
سلام. برام یه مشکلی پیش اومده . الان تشخیص برخورد دو مستطیل رو به این شکل نوشتم :
bool MRectangle::HitTo( MRectangle other )
{
if (position.X+this->w<other.position.X) return false;
if (position.X>other.position.X+other.w) return false;
if (position.Y+this->h<other.position.Y) return false;
if (position.Y>other.position.Y+other.h) return false;
return true;
}
مشخصه که دیگه چی کار کردم. بعد الان این درسته و خوب جواب میده . ولی اگه قرار باشه بچرخه که باید بچرخه چی ؟ اونوقت جریان فرق میکنه ؟ :متفکر:
bool MRectangle::HitTo( MRectangle other )
{
if (position.X+this->w<other.position.X) return false;
if (position.X>other.position.X+other.w) return false;
if (position.Y+this->h<other.position.Y) return false;
if (position.Y>other.position.Y+other.h) return false;
return true;
}
مشخصه که دیگه چی کار کردم. بعد الان این درسته و خوب جواب میده . ولی اگه قرار باشه بچرخه که باید بچرخه چی ؟ اونوقت جریان فرق میکنه ؟ :متفکر: