Collision between two rects
in
Programming Questions
•
1 year ago
Does any body know how to detect and implement collisions between two 50x50 rects? I am using the selter.motion library with Processing 2.0a6. Here is my detection code:
boolean bouncing() {
return ????;
}
And my bouncing code:
if(!bouncing()) {
background(128);
// all my code
}
else {
mp.springTo((mp.getX() - mb.getX())*(-1), ((mp.getY() - mb.getY())*(-1)));
mb.springTo((mb.getX() - mp.getX())-1, ((mb.getY() - mp.getY())-1));
}
Thanks!
1