Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1.            
  2.  
  3.             int x1 = button1.Location.X;
  4.             int y1 = button1.Location.Y;
  5.             int x2 = button2.Location.X;
  6.             int y2 = button2.Location.Y;
  7.  
  8.  
  9.             if (x2 >= 1480 || x2 <= 0 || y2 >=780 || y2 <=0)
  10.             {
  11.                 button2.Location = new Point(ran.Next(1, 148)*10, ran.Next(1, 78)*10);
  12.             }
  13.             if (x1-x2<50&&x1-x2>0)
  14.             {
  15.                 button2.Location = new Point(x2 - level, y2);
  16.             }
  17.             if(x1-x2<0&&x1-x2>-50)
  18.             {
  19.                 button2.Location = new Point(x2 + level, y2);
  20.             }
  21.             if(y1-y2<50&&y1-y2>0)
  22.             {
  23.                 button2.Location = new Point(x2, y2 - level);
  24.             }
  25.             if(y1-y2<0&&y1-y2>-50)
  26.             {
  27.                 button2.Location = new Point(x2, y2 + level);
  28.             }
  29.             if(button1.Location == button2.Location)
  30.             {
  31.                 level += 10;
  32.                 cought++;
  33.                 button2.Location = new Point(ran.Next(1, 148)*10, ran.Next(1, 78)*10);
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement