Exemple #1
0
 public void LoadMap(int [,] map)
 {
     for (int i = 0; i < map.GetLength(0); i++)
     {
         for (int j = 0; j < map.GetLength(1); j++)
         {
             Rectangle rect = new Rectangle(j * Globals.TileWidth,
                                            i * Globals.TileHeight,
                                            Globals.TileWidth,
                                            Globals.TileHeight);
             if (map[i, j] == 1)
             {
                 Tiles[j, i] = new Metal(rect);
             }
             else if (map[i, j] == 2)
             {
                 Tiles[j, i] = new Brick(rect);
             }
             else if (map[i, j] == 3)
             {
                 SpawnPoints[0] = new Rectangle(rect.X + 1, rect.Y + 1, 13, 13);
             }
             else if (map[i, j] == 4)
             {
                 SpawnPoints[1] = new Rectangle(rect.X + 1, rect.Y + 1, 13, 13);
             }
         }
     }
 }