Time for action – the TileMap class – part 2
Add methods dealing with locating map cells to the TileMap class:
#region Information about Map Cells static public int GetCellByPixelX(int pixelX) { return pixelX / TileWidth; } static public int GetCellByPixelY(int pixelY) { return pixelY / TileHeight; } static public Vector2 GetCellByPixel(Vector2 pixelLocation) { return new Vector2( GetCellByPixelX((int)pixelLocation.X), GetCellByPixelY((int)pixelLocation.Y)); } static public Vector2 GetCellCenter(int cellX, int cellY) { return new Vector2( (cellX * TileWidth) + (TileWidth / 2), (cellY * TileHeight) + (TileHeight / 2)); } static public Vector2 GetCellCenter(Vector2 cell) { return GetCellCenter( (int)cell.X, (int)cell.Y); } static public Rectangle CellWorldRectangle(int cellX, int cellY) { return new Rectangle( cellX * TileWidth, cellY * TileHeight, TileWidth, TileHeight); } static public...