title: Problems with a tile worldscreen system?
body: <p>Im trying to make a tile based world screen for my game , here are the three classes i have</p>
  
  <pre><code>namespace WindowsGame1
  {
   public enum Tiletype
  {Grass,
      Water,
      Foothill,
      Mountain
  
  }
  public struct Tile
  {
      public  Tiletype TerrainType { get; set; }
      public Texture2D TileGFX { get; set; }
      public Rectangle SrcRect { get; set; }
      public Vector2 Location { get; set; }
      public int AniFrame { get; set; }
  
      // TILE ACTIONS
      public bool IsActivated { get; set; }
      public bool IsBlocked { get; set; }
      public bool IsTouchTrigger { get; set; }
      public bool IsStepTrigger { get; set; }
  }
  }
  </code></pre>
  
  <p>MapBase class</p>
  
  <pre><code>    public class MapBase
  {
  
      public Tile[,] TileList = new Tile[1, 1];
      public MapBase(int width, int height, Vector2 start)
      {
          TileList = new Tile[width + 1, height + 1];
  
          // TEMPORARY MAP
          for (int X = 0; X &lt;= width; X++)
          {
              for (int Y = 0; Y &lt;= height; Y++)
              {
                  TileList[X, Y] = new Tile();
                  var _with1 = TileList[X, Y];
                  _with1.TerrainType = Tiletype.Water;
                  _with1.TileGFX = Textures.World;
                  _with1.AniFrame = 0;
                  _with1.IsBlocked = true;
              }
          }
  
          // SIMPLE ISLAND
          for (int z = 22; z &lt;= 33; z++)
          {
              for (int c = 22; c &lt;= 31; c++)
              {
                  TileList[z, c].TerrainType = Tiletype.Grass;
              }
          }
  
          TileList[27, 25].TerrainType = Tiletype.Foothill;
          TileList[28, 25].TerrainType = Tiletype.Foothill;
          TileList[27, 24].TerrainType = Tiletype.Foothill;
          TileList[28, 26].TerrainType = Tiletype.Mountain;
  
  
          for (int x = 0; x &lt;= width; x++)
          {
              for (int y = 0; y &lt;= height; y++)
              {
                  TileList[x, y].SrcRect = GetTileSource(TileList[x, y].TerrainType);
              }
          }
  
      }
  </code></pre>
  
  <p>GetTitleSource function</p>
  
  <pre><code>    private Rectangle GetTileSource(Tiletype TType)
      {
          Rectangle sRect = default(Rectangle);
          switch (TType)
          {
              case Tiletype.Grass:
                  sRect = new Rectangle(0, 0, 16, 16);
                  break;
              case Tiletype.Water:
                  sRect = new Rectangle(0, 80, 16, 16);
                  break;
              case Tiletype.Foothill:
                  sRect = new Rectangle(48, 0, 16, 16);
                  break;
              case Tiletype.Mountain:
                  sRect = new Rectangle(32, 0, 16, 16);
                  break;
          }
          return sRect;
      }
  }
  </code></pre>
  
  <p>Class WorldScreen</p>
  
  <pre><code> class Worldscreen : BaseScreen
  {
      public int MapWidth = 100;
      public int MapHeight = 100;
      public int TileSize = 32;
      public int MapX = 20;
      public int MapY = 19;
      public MapBase Map = new MapBase(100, 100, new Vector2(0, 0));
  
      public Worldscreen(GraphicsDevice device)
          : base(device, "WorldScreen")
      {
          Map = new MapBase(MapWidth, MapHeight, new Vector2(0, 0));
      }
  </code></pre>
  
  <p>Draw function</p>
  
  <pre><code>    public override void Draw(GameTime gameTime)
      {
          base.Draw(gameTime);
          Globals.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone);
  
          //DRAW TILE LAYER
          for (int DrawX = -1; DrawX &lt;= 16; DrawX++)
          {
              for (int DrawY = -1; DrawY &lt;= 15; DrawY++)
              {
                  int x = DrawX + MapX;
                  int y = DrawY + MapY;
  
                  if (x &gt; 0 &amp; x &lt;= MapWidth &amp; y &gt;= 0 &amp; y &lt;= MapHeight)
                  {
                      Globals.spriteBatch.Draw(Map.TileList[x,y].TileGFX, new Rectangle(DrawX * TileSize, DrawY * TileSize, TileSize, TileSize), Map.TileList[x, y].SrcRect, Color.White);
                      // VIEW COORDINATES ON TILE
                      //Globals.SpriteBatch.DrawString(Fonts.Arial_8, "X:" &amp; x &amp; vbCrLf &amp; "Y:" &amp; y, New Vector2(DrawX * TileSize, DrawY * TileSize), Color.Black)
                  }
              }
          }
          Globals.spriteBatch.End();
      }
  }
  </code></pre>
  
  <p>When I try to run the draw void it comes up with this error on the world screen class
  This method does not accept null for this parameter.
  Parameter name: texture </p>
  
  <p>is there any way to solve this or do i have to rework these classes.</p>