Example #1
0
 void GenerateHolesR(int left, int top, int width, int height)
 {
     if (Holes.Count == 5) return;
     int x = random.Next(left + Hole.RADIUS, (left + width) - Hole.RADIUS);
     int y = random.Next(top + Hole.RADIUS, (top + height) - Hole.RADIUS);
     bool touches = false;
     foreach (Hole h in Holes)
     {
         touches = h.Touches(x, y);
         if (touches) break;
     }
     if (!touches)
     {
         Hole h = new Hole(new Point(x, y));
         Holes.Add(h);
     }
     GenerateHolesR(left, top, width, height);
 }
Example #2
0
File: Ball.cs Project: AtanasK/VP
 public bool InHole(Hole hole)
 {
     float d = (Center.X - hole.Center.X) * (Center.X - hole.Center.X) + (Center.Y - hole.Center.Y) * (Center.Y - hole.Center.Y);
     return d <= RADIUS * RADIUS;
 }
Example #3
0
File: Hole.cs Project: kmartin62/VP
 public bool Colliding(Hole hole)
 {
     return(((hole.Centar.X - Centar.X) * (hole.Centar.X - Centar.X) + (hole.Centar.Y - Centar.Y) * (hole.Centar.Y - Centar.Y)) <= hole.RADIUS * RADIUS);
     //return (x - Centar.X) * (x - Centar.X) + (y - Centar.Y) * (y - Centar.Y) <= RADIUS * RADIUS;
 }