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; }
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; }