Guest User

Untitled

a guest
Feb 5th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1.         const int MAPWIDTH = 50;
  2.         const int MAPHEIGHT = 20;
  3.  
  4.         static char[,] map = new char[MAPWIDTH, MAPHEIGHT];
  5.  
  6.         public void InitMap()
  7.         {
  8.             for (int y = 0; y < MAPHEIGHT; y++)
  9.                 for (int x = 0; x < MAPWIDTH; x++)
  10.                     map[x, y] = '.';
  11.         }
  12.  
  13.         public void DisplayMap(string locationName)
  14.         {
  15.             for (int y = 0; y < MAPHEIGHT; y++, Console.WriteLine())
  16.                 for (int x = 0; x < MAPWIDTH; x++)
  17.                     Console.WriteLine(map[x, y]);
  18.             Console.Read();
  19.         }
  20.  
  21.         public void AddRoom(char wall, char floor, int w, int h, int xpos, int ypos)
  22.         {
  23.             for (int y = 0; y < h; y++)
  24.                 for (int x = 0; x < w; x++)
  25.                     map[x + xpos, y + ypos] = x == 0 || x == w - 1 || y == 0 || y == h - 1 ? wall : floor;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment