public bool IsColiding(Ball ball) { double d = (Center.X - ball.Center.X) * (Center.X - ball.Center.X) + (Center.Y - ball.Center.Y) * (Center.Y - ball.Center.Y); return d <= (2 * RADIUS) * (2 * RADIUS); }
public void AddBall(Ball ball) { Balls.Add(ball); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { Ball ball = new Ball(e.Location, currentColor); ballsDoc.AddBall(ball); Invalidate(true); }