static void Main(string[] args) { Console.SetWindowSize(1, 1); Console.SetBufferSize(80, 25); Console.SetWindowSize(80, 25); Vert VertL = new Vert(0, 24, 0, "*"); VertL.Draw(); Gor GorD = new Gor(0, 78, 24, "*"); GorD.Draw(); Vert VertR = new Vert(0, 24, 78, "*"); VertR.Draw(); Gor GorUp = new Gor(0, 78, 0, "*"); GorUp.Draw(); Point p = new Point(4, 5, "*"); Snake snake = new Snake(p, 4, Direction.right); //Point p = new Point(5, 6, "+"); //p.Draw(); //Console.ReadLine(); }
public Walls(int mapW, int mapH) { walllist = new List <Figure>(); Vert VertL = new Vert(0, mapH - 1, 0, "*"); Gor GorD = new Gor(0, mapW - 2, mapH - 1, "*"); Vert VertR = new Vert(0, mapH - 1, mapW - 2, "*"); Gor GorUp = new Gor(0, mapW - 2, 0, "*"); walllist.Add(VertL); walllist.Add(VertR); walllist.Add(GorUp); walllist.Add(GorD); }
static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.SetWindowSize(1, 1); Console.SetBufferSize(80, 25); Console.SetWindowSize(80, 25); Vert VertL = new Vert(0, 24, 0, "*"); VertL.Draw(); Gor GorD = new Gor(0, 78, 24, "*"); GorD.Draw(); Vert VertR = new Vert(0, 24, 78, "*"); VertR.Draw(); Gor GorUp = new Gor(0, 78, 0, "*"); GorUp.Draw(); Walls walls = new Walls(80, 25); walls.Draw(); Point p = new Point(4, 5, "+"); //Vert vl = new Vert(0, 10, 5, "%"); //Draw(vl); //Point p = new Point(4, 5, "*"); //Figure fsnake = new Snake(p, 4, Direction.right); //Draw(fsnake); //Snake snake = (Snake)fsnake; //Gor gl = new Gor(0, 5, 6, "#"); //Draw(gl); //List<Figure> figures = new List<Figure>(); //figures.Add(fsnake); //figures.Add(vl); //figures.Add(gl); //foreach(var f in figures) //{ // f.Draw(); //} Snake snake = new Snake(p, 4, Direction.right); snake.Draw(); Food FoodCreator = new Food(80, 25, "$"); Point food = FoodCreator.CreateFood(); food.Draw(ConsoleColor.Black); tttt tttt = new tttt(0); while (true) { int a = 0; if (walls.IsHit(snake) || snake.IsHitTail()) { break; } if (snake.Eat(food)) { food = FoodCreator.CreateFood(); food.Draw(ConsoleColor.Red); } else { snake.move(); } Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(); snake.handl(key.Key); } } WriteScore(); Console.ReadLine(); }