-
Book Overview & Buying
-
Table Of Contents
XNA 4 3D Game Development by Example: Beginner's Guide
By :
1. Right-click on the Cube Chaser project in Solution Explorer and select Add | Class....
2. Name the new class MazeCell and click OK.
3. Add the following declarations to the MazeCell class:
public bool[] Walls = new bool[4] {true, true, true, true};
public bool Visited = false;The definition of each
maze cell is very straightforward. We have an array of Boolean values for the walls of the cell. A true value indicates that a wall exists in that position, and a false value indicates that the wall is an opening. In the declaration of the array, we have provided initialization values, specifying that a newly-generated cell will have walls on all four sides. We will arbitrarily decide that the first entry in the array (index 0) is the north wall of the cell. From there, we will proceed clockwise around the cell for the remaining walls (1 is equal to east, 2 is equal to south, and 3 is equal to west) as shown in the following image:

The...
Change the font size
Change margin width
Change background colour