Beispiel #1
0
 public point Next(snake Snake, walls wall)
 {
     int x;
     int y;
     point p;
     do
     {
         x = rnd.Next(1, whidth - 1);
         y = rnd.Next(1, height - 1);
         p = new point(x, y, s);
     } while (Snake.IsHit(p) || wall.IsHit(p));
     return p;
 }
Beispiel #2
0
 public int Start(int lvl)
 {
     Console.Clear();
     Console.SetCursorPosition(width / 2 - 5, height / 2);
     Console.Write("Уровень " + lvl.ToString());
     Thread.Sleep(1000);
     Console.Clear();
     Console.SetCursorPosition(3, height + 2);
     Console.Write("Счет:");
     Console.SetCursorPosition(10, height + 2);
     Console.Write("Уровень:");
     Console.SetCursorPosition(13, height + 3);
     Console.Write(lvl);
     Snake = new snake(pos, 4, direction.RIGHT);
     Console.SetCursorPosition(5, height + 3);
     Console.Write(Snake.GetScore() * speed);
     wall = new walls(width, height, lvl);
     fp = new foodpoint(width, height, 2);
     food = fp.Next(Snake, wall);
     food.Draw();
     Play(1);
     int sc = Snake.GetScore() * speed;
     Snake.ResetScore();
     return sc;
 }