As you can see, we haven't created any holes yet to go from one floor level to the other. The generator now accomplishes this task by simply replacing some ladders with holes. It randomly picks a cell and checks if it's a ladder. If it's not, it moves to the cell located on the east side and checks again. If it has reached the right edge of the map without finding a ladder, it gives up and randomly picks another cell. The number of times it does this process is equal to the map number, but not more than 40 times. If it does find a ladder leading up OR down (not both!), it makes sure the destination is not a ladder leading up AND down. We don't want the player to jump in a hole and land 2 floors below (ouch!). If it's not the case, the ladders are changed to appropriate holes.
Move the mouse pointer over the image to view the map before the change. |