First of all, I know that there are very similar questions answered already, but I haven't seen this question in particular asked yet.
I have an oval and a rectangle and I want to detect if they are intersecting. I know you can do this with two rectangles like so:
if (new Rectangle(x1, y1, w1, h1).intersects(new Rectangle(x2, y2, w2, h2))) {
//code here for when collision occurs.
}
Is it possible to do this with an oval like so?
if (new Oval(x1, y1, w1, h1).intersects(new Rectangle(x2, y2, w2, h2))) {
//code here for when collision occurs.
}
Thanks in advance!