Beispiel #1
0
bool Bomberman::collision(Wall wall)
{
        if(y + width <= wall.getY())
                return 0;
        if(x + length <= wall.getX())
                return 0;
        if(y >= wall.getY() + wall.getWidth())
                return 0;
        if(x >= wall.getX() + wall.getLength())
                return 0;
        return 1;   
}
Beispiel #2
0
bool checkNearness(Disc d, Wall w,int wallno)
{
	bool cond = (wallno==0 || wallno==2);
	if(abs((cond?d.getY():d.getX()) - (cond?w.getY():w.getX())) <= d.getRadius() && (cond?d.getVy():d.getVx())*(cond?w.getY():w.getX())>= 0)
	{
		//cout<<d.getDiscNo()<<" colliding with wall"<<wallno<<endl;
		return true;
	}
	return false;
}
Beispiel #3
0
bool Wall::operator!=(const Wall & c)
{	
	/*
	* This function allows us to check if our first wall
	* is already equal to our RandWall. If they are already
	* equal then we won't perform the = operator.
	*/
	if (getY() == c.getY())
	{
		return false;
	}
	return true;
}