Hey i just got into processing and was wondering
how i could make the ball explode once its touched the
constrained wall.
Finding it difficult with the codes still but really keen to learn. I pretty much follwed the constrain code and trying to make it explode. any help would be much apreciated
This is what i have so far:
// Code Setup For Box And Ball Delay >>>>>>>>>>>>>>>>>>>>>>>
float mx;
float my;
float delay = 70.0;
float esize = 20.0;
int box = 30;
void setup()
{
size(400, 400);
noStroke();
smooth();
ellipseMode(RADIUS);
}
void draw()
{
background(255);
// The Cordinates Of The Mouse >>>>>>>>>>>>>>>>>>>>>>>>>
// if(abs(mouseX - mx) > 0.5) {
mx = mx + (mouseX - mx)/delay;
// }
// if(abs(mouseY - my) > 0.5) {
my = my + (mouseY- my)/delay;
// }
// Box That The Ball Is Contained >>>>>>>>>>>>>>>>>>>>>>>>>>
float distance = esize * 2;
mx = constrain(mx, box+distance, width-box-distance);
my = constrain(my, box+distance, height-box-distance);
// The Black Box >>>>>>>>>>>>>>>>>>>>>>>>>>>
fill(0);
rect(box+esize, box+esize, box*10, box*10);
fill(255);
ellipse(mx, my, esize, esize);
}