We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey guys, I'm doing a simple billiards game in processing for my class and was wondering how I go about getting the cue ball and the eight ball to collide with each other.
int cueBall;
int eightBall;
int mouseClick=0;
void setup(){
background(0,153,0);
size(600,300);
}
void draw(){
}
void mousePressed() {
//background(0,153,0);
mouseClick++;
if (mouseClick==1) {
stroke(0);
fill(255,255,255);
ellipseMode(CENTER);
ellipse(mouseX, mouseY, 50,50);
}
if (mouseClick==2) {
stroke(0);
fill(0,0,0);
ellipseMode(CENTER);
ellipse(mouseX, mouseY, 50,50);
}
}
Answers
This is a little more complicated than you might expect.
Check out the CircleCollsion example in the Motion section of the examples. (File -> Examples -> Motion -> CircleCollsion)