static void Main(string[] args) { //Console.SetBufferSize(999, 25); // Draw frame HorizontalLine upLine = new HorizontalLine(0, 78, 0, '+'); HorizontalLine downLine = new HorizontalLine(0, 78, 24, '+'); VerticalLine leftLine = new VerticalLine(0, 24, 0, '+'); VerticalLine rightLine = new VerticalLine(0, 24, 78, '+'); upLine.Drow(); downLine.Drow(); leftLine.Drow(); rightLine.Drow(); Point p = new Point(2, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); while (true) { if(Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } System.Threading.Thread.Sleep(100); snake.Move(); } Console.ReadLine(); }
static void Main(string[] args) { Horizontalline upline = new Horizontalline(0, 78, 0, '+'); upline.Drow(); Horizontalline downline = new Horizontalline(0, 78, 24, '+'); upline.Drow(); Verticalline leftline = new Verticalline(0, 24, 0, '+'); leftline.Drow(); Verticalline rightline = new Verticalline(0, 24, 78, '+'); rightline.Drow(); Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); Console.ReadLine(); }
static void Main(string[] args) { Console.SetBufferSize(80, 25); Walls walls = new Walls(80, 25); walls.Draw(); //Отрисовка точек Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); 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(); } Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } } Console.ForegroundColor = ConsoleColor.Cyan; Console.SetCursorPosition(33, 11); Console.WriteLine("GAME OVER"); Console.SetCursorPosition(33, 12); Console.WriteLine("Thanks for Watching"); Console.SetCursorPosition(33, 13); Console.WriteLine("Maks EMS production with GeekBrains"); Console.SetCursorPosition(33, 14); Console.WriteLine("Press Enter for exit"); Console.ReadLine(); }
static void Main(string[] args) { Console.SetBufferSize(80, 25); Walls walls = new Walls(80, 25); walls.Draw(); //отрисовка точек Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 3, Direction.Right); snake.Drow(); 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(); } Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } } }
static void Main(string[] args) { Console.SetBufferSize(80, 25); Walls walls = new Walls(80, 25); walls.Drow(); //Отрисовка точек Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); FoodCreator foodCreator = new FoodCreator(80, 25, '$'); Point food = foodCreator.CreateFood(); food.Drow(); while (true) { if (walls.IsHit(snake) || snake.IsHitTail()) { break; } if (snake.Eat(food)) { food = foodCreator.CreateFood(); food.Drow(); } else { snake.Move(); } Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.HandleKey(key.Key); } } }
static void Main(string[] args) { Console.SetBufferSize(80, 25); // Нарисуем рамку HorizontalLine lineHup = new HorizontalLine(0, 78, 0, '+'); HorizontalLine lineHdown = new HorizontalLine(0, 78, 24, '+'); VerticalLine lineVr = new VerticalLine(0, 24, 0, '+'); VerticalLine lineVl = new VerticalLine(0, 24, 78, '+'); lineHup.Drow(); lineHdown.Drow(); lineVr.Drow(); lineVl.Drow(); Point p = new Point(4, 5, '@'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); Console.ReadLine(); }
static void Main(string[] args) { Console.SetBufferSize(120, 30); //Отрисовка рамки HorizontalLines upLine = new HorizontalLines(0, 118, 0, '+'); HorizontalLines downLine = new HorizontalLines(0, 118, 29, '+'); VerticalLines leftLine = new VerticalLines(0, 0, 29, '+'); VerticalLines rightLine = new VerticalLines(118, 0, 29, '+'); upLine.Drow(); downLine.Drow(); leftLine.Drow(); rightLine.Drow(); //Отрисовка точек Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGHT); snake.Drow(); snake.Move(); }