Time for action – dealing with map squares
Add methods to the
TileMap
module that deal with map squares and translate pixel coordinates into map square references:#Region "Information about Map Squares" Public Function GetSquareByPixelX(pixelX As Integer) As Integer Return CInt(Int(pixelX / TileWidth)) End Function Public Function GetSquareByPixelY(pixelY As Integer) As Integer Return CInt(Int(pixelY / TileHeight)) End Function Public Function GetSquareAtPixel(pixelLocation As Vector2) As Vector2 Return New Vector2( GetSquareByPixelX(CInt(Int(pixelLocation.X))), GetSquareByPixelY(CInt(Int(pixelLocation.Y)))) End Function Public Function GetSquareCenter( squareX As Integer, squareY As Integer) As Vector2 Return New Vector2( (squareX * TileWidth) + (TileWidth / 2.0F), (squareY * TileHeight) + (TileHeight / 2.0F)) End Function Public Function GetSquareCenter(square As Vector2) As Vector2 Return GetSquareCenter(CInt(Int...