I need in some way to generate maze because I want to create a maze game. If anybody has any idea on how to do this... please help

thanks ill check it..

ok but is there any way to generate a maze at form load so that each time the maze is different?

also how would i set the bounds that the user can move so that it does not pass through walls?

First, you need to create a PictureBox. Then, you need to create code to generate a maze in an array. Once the maze is generated, you need to create code to display the maze in the PictureBox based on the information in the array. After you have code to create the maze and display it, you need to add code to the Load event of the form so that the maze is displayed whenever the form is loaded. Lastly, you need to create code to track where the user is, prevent the user from crossing any walls and to display the user on the PictureBox.

i know what i have to do the problem is HOW to do it...

i need help with the code...
this is not my homework :D

To help you in the right direction, for a maze program I made, I had a class called cell. The cell class had the following properties: bottomWall, leftWall, visited, enabled.

The bottomWall and leftWall properties is to track where within the maze the walls are and the visited property was for one of the maze algorithms I was using. I then made a 2D array of the class cell. Each cell within the array represented one 'square' in the maze.

With many maze generation algorithms, the maze starts with all the cells having walls and the maze is generated by "removing" walls.

that helpful
BUT
i have no idea how to generate it and remove walls...:S

could you just help a little with the code?

Go to this site and look at Prims algorithm; while it doesn't make the hardest mazes, it is a simple algorithm to start with: http://www.astrolog.org/labyrnth/algrithm.htm

What you need to do is set up the array of cells I mentioned above. For each cell, in addition to the wall properties, you need to make a property for status (in, out, frontier). When the term carving is mentioned, remove the wall between the cells.

Try setting up the cell class and the array for the maze. Once you have that done, I will help you with the code for the maze generation.

how do you create an array with walls????????????????????????????????????

and also you said somethingg about some wall properties which i dont understand

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.