Time for action – the TileMap module – part 2
Add methods dealing with locating map cells to the
TileMap
module:#Region "Information about Map Cells" Public Function GetCellByPixelX(pixelX As Integer) As Integer Return CInt(Int(pixelX / TileWidth)) End Function Public Function GetCellByPixelY(pixelY As Integer) As Integer Return CInt(Int(pixelY / TileHeight)) End Function Public Function GetCellByPixel(pixelLocation As Vector2) As Vector2 Return New Vector2( GetCellByPixelX(CInt(Int(pixelLocation.X))), GetCellByPixelY(CInt(Int(pixelLocation.Y)))) End Function Public Function GetCellCenter( cellX As Integer, cellY As Integer) As Vector2 Return New Vector2( CSng((cellX * TileWidth) + (TileWidth / 2)), CSng((cellY * TileHeight) + (TileHeight / 2))) End Function Public Function GetCellCenter(cell As Vector2) As Vector2 Return GetCellCenter( CInt(Int(cell.X)), CInt(Int(cell.Y))) End Function Public Function...