I am making a breakout game for a school project. The only problem I am running into is the Ball Bouncing when the Ball and Bricks collide. I used ball1.getEllipse().intersects(b.getRectangle()) allowing me to figure out when it is colliding and delete the brick. The bouncing chances depending on the side it collided with. This is the main problem. The .intersect piece does not show me which side the brick gets hit by. I need this to know whether to change the x or y speed. If anyone has any idea on how to figure this out, please leave your input (I have been trying to think of a solution for 5 hours, I gave up)
public void collision(int i) {
for (Block b : blocks) {
if (ball1.getEllipse().intersects(b.getRectangle())) {
if (!b.isDestroyed()) {
b.destroy();
blockCount-=1;
ball1.brickBounce();`public void collision(int i) {