private bool ballsCollide(HandleObject ballA, HandleObject ballB) { double a = ballA.getRadius() + ballB.getRadius(); double dx = ballA.center().X - ballB.center().X; double dy = ballA.center().Y - ballB.center().Y; return a * a > (dx * dx + dy * dy); }
public bool isBallScored(HandleObject ball) { if (box.isPointInside(ball.center()) && ball.getVelocity().Y > 0 ) { score++; cheer.Play(); ball.processed(); return true; } return false; }