Exemple #1
0
        static void Main(string[] args)
        {
            Console.SetBufferSize(80, 25);

            HorizontLine upLine    = new HorizontLine(0, 78, 0, '=');
            HorizontLine downLine  = new HorizontLine(0, 78, 24, '=');
            VerticalLine leftLine  = new VerticalLine(1, 23, 0, '|');
            VerticalLine rightLine = new VerticalLine(1, 23, 78, '|');

            upLine.Drow();
            downLine.Drow();
            leftLine.Drow();
            rightLine.Drow();

            Point p     = new Point(5, 5, '*');
            Snake snake = new Snake(p, 5, Direction.RIGHT);

            snake.Drow();

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    snake.GetDirection(key.Key);
                }

                snake.Move();
                snake.Drow();

                Thread.Sleep(100);
            }

            Console.ReadLine();
        }
Exemple #2
0
        public void DrawWalls() // Создаются и отрисовываются границы игрового поля
        {
            HorizontLine upWall    = new HorizontLine(0, GameFieldWidth, 0, '+');
            HorizontLine downWall  = new HorizontLine(0, GameFieldWidth, GameFieldHeigth, '+');
            VerticalLine leftWall  = new VerticalLine(0, GameFieldHeigth, 0, '+');
            VerticalLine rightWall = new VerticalLine(0, GameFieldHeigth, GameFieldWidth, '+');

            walls = new List <Figure> {
                upWall, downWall, leftWall, rightWall
            };
            foreach (Figure wall in walls)
            {
                wall.Draw();
            }
        }
Exemple #3
0
        public Walls(int mapWidth, int mapHeigth)
        {
            wallList = new List<Figure>();

            Console.SetWindowSize(mapWidth, mapHeigth);

            HorizontLine lineTop = new HorizontLine(0, mapWidth - 2, 0, '+');
            HorizontLine lineFoot = new HorizontLine(0, mapWidth - 2, mapHeigth -1, '+');
            VertLine leftLine = new VertLine(0, mapHeigth - 1, 0, '+');
            VertLine rightLine = new VertLine(0, mapHeigth - 1, mapWidth - 2, '+');

            wallList.Add(lineTop);
            wallList.Add(lineFoot);
            wallList.Add(leftLine);
            wallList.Add(rightLine);
        }
Exemple #4
0
        public Walls(int mapWidth, int mapHeigth)
        {
            wallList = new List <Figure>();

            Console.SetWindowSize(mapWidth, mapHeigth);

            HorizontLine lineTop   = new HorizontLine(0, mapWidth - 2, 0, '+');
            HorizontLine lineFoot  = new HorizontLine(0, mapWidth - 2, mapHeigth - 1, '+');
            VertLine     leftLine  = new VertLine(0, mapHeigth - 1, 0, '+');
            VertLine     rightLine = new VertLine(0, mapHeigth - 1, mapWidth - 2, '+');

            wallList.Add(lineTop);
            wallList.Add(lineFoot);
            wallList.Add(leftLine);
            wallList.Add(rightLine);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(1, 1);
            Console.SetBufferSize(80, 25);
            Console.SetWindowSize(80, 25);

            //Рамочка
            HorizontLine upLine     = new HorizontLine(0, 78, 0, '+');
            HorizontLine downLine   = new HorizontLine(0, 78, 24, '+');
            VertLine     leftLine   = new VertLine(0, 24, 0, '+');
            VertLine     righttLine = new VertLine(0, 24, 78, '+');

            upLine.Drow();
            downLine.Drow();
            leftLine.Drow();
            righttLine.Drow();


            Point p = new Point(4, 5, '*');

            p.Draw();
        }