public void draw(MazeGenerator maze, BufferedGraphics buffer, int[,] mazeArray)
        {

            for (int i = 0; i < maze.height; i++)
            {
                for (int j = 0; j < maze.width; j++)
                {
                    if (mazeArray[i, j] == 2)
                    {
                        if (j < 24 && mazeArray[i, j + 1] == 0)
                        {
                            buffer.Graphics.DrawImage(Image3, new Rectangle(20 * i, 20 * j, 20, 20));
                        }
                        else
                        {
                            buffer.Graphics.DrawImage(Image1, new Rectangle(20 * i, 20 * j, 20, 20));
                        }
                    }
                    else
                    {
                        buffer.Graphics.DrawImage(Image2, new Rectangle(20 * i, 20 * j, 20, 20));

                    }
                }

            }
        }
 public static void Main()
 {
     Console.SetWindowSize(120, 60);
     MazeGenerator maze = new MazeGenerator(51,101);
     int[,] playArea = maze.generateMaze(1, 1);
     maze.Print();
 }
Example #3
0
        public static void Main()
        {
            Console.SetWindowSize(120, 60);
            MazeGenerator maze = new MazeGenerator(51, 101);

            int[,] playArea = maze.generateMaze(1, 1);
            maze.Print();
        }
Example #4
0
 public void draw(MazeGenerator maze, BufferedGraphics buffer, int[,] mazeArray)
 {
     for (int i = 0; i < maze.height; i++)
     {
         for (int j = 0; j < maze.width; j++)
         {
             if (mazeArray[i, j] == 2)
             {
                 if (j < 24 && mazeArray[i, j + 1] == 0)
                 {
                     buffer.Graphics.DrawImage(Image3, new Rectangle(max * i, max * j, max, max));
                 }
                 else
                 {
                     buffer.Graphics.DrawImage(Image1, new Rectangle(max * i, max * j, max, max));
                 }
             }
             else
             {
                 buffer.Graphics.DrawImage(Image2, new Rectangle(max * i, max * j, max, max));
             }
         }
     }
 }
Example #5
0
        static void Main(string[] args)
        {
            var generator = new MazeGenerator();
            var maze      = generator.GenerateMaze(30, 8);

            for (int y = 0; y < maze.Height * 3; y++)
            {
                for (int x = 0; x < maze.Width * 3; x += 3)
                {
                    int realY = y / 3;
                    int realX = x / 3;
                    int line  = y % 3;

                    switch (line)
                    {
                    case 0:
                        Console.Write("▓");
                        if (maze.Tiles[realY, realX].HasAnyWall(TileWall.North))
                        {
                            Console.Write("▓");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                        Console.Write("▓");
                        break;

                    case 1:
                        if (maze.Tiles[realY, realX].HasAnyWall(TileWall.West))
                        {
                            Console.Write("▓");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                        Console.Write(" ");
                        if (maze.Tiles[realY, realX].HasAnyWall(TileWall.East))
                        {
                            Console.Write("▓");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                        break;

                    case 2:
                        Console.Write("▓");
                        if (maze.Tiles[realY, realX].HasAnyWall(TileWall.South))
                        {
                            Console.Write("▓");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                        Console.Write("▓");
                        break;
                    }
                }
                Console.WriteLine();
            }


            //for(int y=0; y < maze.Height; y++) {
            //    for(int x=0; x < maze.Width; x++) {
            //        PrintTile(maze.Tiles[y,x]);
            //    }
            //    Console.WriteLine(String.Empty);
            //}

            Console.ReadLine();
        }