Adding Walls

The next step is to have walls on the maze, in order to do this there will be several wall segments dividing all cells. and they will be stored in separate arrays in order to help with determining the index of the wall that needs to be removed.
This first image shows the different types of walls, there are the Vertical walls(RED) and the Horizontal Walls (BLUE) there will be an array in order to store each of these. below you can see the indecies of these walls:

Looking at the picture above shows the reasoning for having these separate arrays, lets say I am on cell number 5 and want to open a path to cell number 16 then there are only two steps to determine what to do:

1) Determine that the cell you are traveling to is underneath the current cell (this means that you will be removing a horizontal wall)

2) use the same index value of the current cell to access the horizontal walls array and make sure to make it disappear.

No comments:

Post a Comment