944,007 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2457
  • VB.NET RSS
Nov 24th, 2008
0

Maze Game

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007
Nov 24th, 2008
0

Re: Maze Game

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
Reputation Points: 27
Solved Threads: 29
Posting Whiz
timothybard is offline Offline
317 posts
since Mar 2007
Nov 27th, 2008
0

Re: Maze Game

thanks ill check it..
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007
Nov 27th, 2008
0

Re: Maze Game

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?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007
Nov 27th, 2008
0

Re: Maze Game

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.
Reputation Points: 27
Solved Threads: 29
Posting Whiz
timothybard is offline Offline
317 posts
since Mar 2007
Nov 28th, 2008
0

Re: Maze Game

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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007
Nov 28th, 2008
0

Re: Maze Game

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.
Reputation Points: 27
Solved Threads: 29
Posting Whiz
timothybard is offline Offline
317 posts
since Mar 2007
Nov 30th, 2008
0

Re: Maze Game

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

could you just help a little with the code?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007
Nov 30th, 2008
0

Re: Maze Game

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.
Reputation Points: 27
Solved Threads: 29
Posting Whiz
timothybard is offline Offline
317 posts
since Mar 2007
Nov 30th, 2008
0

Re: Maze Game

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

and also you said somethingg about some wall properties which i dont understand
Last edited by Dell XPS; Nov 30th, 2008 at 12:59 pm.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Dell XPS is offline Offline
85 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: help in data table object
Next Thread in VB.NET Forum Timeline: sql view in vb.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC