| | |
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 |
"crystal .net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port position print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml year






