x = constrain(x + bFinal[0].x, diameter/2, width-diameter/2);
y = constrain(y + bFinal[0].y, diameter/2, height-diameter/2);
// update velocities
speedX = cosine * vFinal[0].x - sine * vFinal[0].y;
speedY = cosine * vFinal[0].y + sine * vFinal[0].x;
other.speedX = cosine * vFinal[1].x - sine * vFinal[1].y;
other.speedY = cosine * vFinal[1].y + sine * vFinal[1].x;
}
}
}
hello im trying to make a
boolean checkCollisionWith(Ball other) method
i finished my program but all i need is that boolean method and to combine the above code with my code but im having problems with the boolean method
the program is an example of a random number of balls between 5 and 20 bouncing on the sides of the window with random diameters between 20 and 80 with random colors and also fading in addition at first when we play the program non of the circles overlap over the other ( i finished all of these ) ..
my problem is combing the above code in order for the balls to bounce when they touch each other with my code and i have a problem to make a boolean checkCollisionWith(Ball other) methodd