I'm making a simple game in java, and I have many methods which test if two object collide. Objects include a man, enemy, arrow, wall, coin and so on. I have a bunch of methods which count for every type of collision which could occur, they look like this:
public boolean collide(Arrow a, Enemy b)
{
Rectangle a1 = a.getBounds();
Rectangle b1 = b.getBounds();
if(a1.intersects(b1)) return true;
else return false;
}
Is there away to create a generic method? I tried using object a and object b as the arguments but the compiler compained it couldn't find getBounds() for the objects.