Esempio n. 1
0
const Rectangulo Magnetman::obtenerRepresentacion() const
{
	return Rectangulo(obtenerPosicion().x-ANCHOMAGNETMAN/2,
			  obtenerPosicion().y-ALTOMAGNETMAN/2,
			  ANCHOMAGNETMAN,
			  ALTOMAGNETMAN);
}
bool colision(int x1 , int y1 , int w1, int h1,int x2, int y2 , int w2, int h2)
{
    if(puntodentrorect(Punto(x2, y2), Rectangulo(Punto(x1,y1),w1,h1)))
    {
        return true;
    }
    if(puntodentrorect(Punto(x2+w2, y2), Rectangulo(Punto(x1,y1),w1,h1)))
    {
        return true;
    }
    if(puntodentrorect(Punto(x2, y2+h2), Rectangulo(Punto(x1,y1),w1,h1)))
    {
        return true;
    }
    if(puntodentrorect(Punto(x2+w2, y2+h2), Rectangulo(Punto(x1,y1),w1,h1)))
    {
        return true;
    }

    return false;


}
Esempio n. 3
0
const Rectangulo Sparkman::obtenerRepresentacion() const{
return Rectangulo(	obtenerPosicion().x-ANCHOSPARKMAN/2,
					obtenerPosicion().y-ALTOSPARKMAN/2,
					ANCHOSPARKMAN,
					ALTOSPARKMAN);}