public void DrawMap(SpriteBatch spriteBatch, Texture2D tileSheet)
{
height = tileMap.GetLength(0); //Map height (in tiles)
width = tileMap.GetLength(1); //Map width (in tiles)
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
Tile cell = tileMap[y, x]; //Cell = value of tile at map position (y,x)
if (cell != null)//If cell exists; otherwise, continue (saves processing time)
{
Rectangle bounds = new Rectangle(x * size, y * size, size, size); //Sets where and what size the tile will be in the game
cell.DrawTile(spriteBatch, bounds);
//spriteBatch.Draw(tileSheet, bounds, sourceBounds, Color.White); //Draws the tile
}
}
}