Time for action – random wall placement
Add the
GenerateRandomMap()
method to theTileMap
module:#Region "Map Generation" Public Sub GenerateRandomMap() Dim wallChancePerSquare As Integer = 10 Dim floorTile As Integer floorTile = _rand.Next(FloorTileStart, FloorTileEnd + 1) Dim wallTile As Integer wallTile= _rand.Next(WallTileStart, WallTileEnd + 1) For x As Integer = 0 to MapWidth - 1 For y As Integer = 0 to MapHeight - 1 _mapSquares(x, y) = floorTile If ((x = 0) Or (y = 0) Or (x = MapWidth - 1) Or (y = MapHeight - 1)) Then _mapSquares(x, y) = wallTile Continue For End If If ((x = 1) Or (y = 1) Or (x = MapWidth - 2) Or (y = MapHeight - 2)) Then Continue For End If If _rand.Next(0, 100) <= wallChancePerSquare Then _mapSquares(x, y) = wallTile End If Next Next End Sub #End Region
Modify the
Initialize()
method of theTileMap
module, by adding a...