static void Main(string[] args) { Console.Write("Write your name: "); string name = Console.ReadLine(); Walls walls = new Walls(80, 25); walls.Draw(); // Отрисовка точек point p = new point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Draw(); FoodCreator foodCreator = new FoodCreator(80, 25, '$'); point food = foodCreator.CreateFood(); food.Draw(); while (true) { if (walls.IsHit(snake) || snake.IsHitTail()) { break; } if (snake.Eat(food)) { food = foodCreator.CreateFood(); food.Draw(); } else { snake.Move(); } System.Threading.Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } } WriteGameOver(); Console.ReadLine(); }
static void Main(string[] args) { Console.Write("Write your name: "); string name = Console.ReadLine(); Walls walls = new Walls(80, 25); walls.Draw(); // Отрисовка точек point p = new point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Draw(); FoodCreator foodCreator = new FoodCreator(80, 25, '$'); point food = foodCreator.CreateFood(); food.Draw(); Params settings = new Params(); /* Sounds sound = new Sounds(settings.GetResourceFolder()); * sound.Play(); * * Sounds sound1 = new Sounds(settings.GetResourceFolder());*/ while (true) { if (walls.IsHit(snake) || snake.IsHitTail()) { break; } if (snake.Eat(food)) { Score ScoreGame = new Score(); ScoreGame.ScoreInGame(snake.score); food = foodCreator.CreateFood(); food.Draw(); /* sound1.PlayEat();*/ } else { snake.Move(); } System.Threading.Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } } /*sound.Stop();*/ GameOverSnake GameOver = new GameOverSnake(); GameOver.WriteGameOver(name, snake.score); Console.ReadLine(); }