| | |
Maze Game
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
There are several maze generation algorithms. You can go here to see a few examples.
http://en.wikipedia.org/wiki/Maze_generation_algorithm
http://www.astrolog.org/labyrnth/algrithm.htm
http://en.wikipedia.org/wiki/Maze_generation_algorithm
http://www.astrolog.org/labyrnth/algrithm.htm
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.
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.
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.
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.
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.
![]() |
Similar Threads
- maze game (C++)
- maze game (C++)
- how to make maze game using "gotoxy" & getch? (C++)
Other Threads in the VB.NET Forum
- Previous Thread: help in data table object
- Next Thread: sql view in vb.net
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






