Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int MAPWIDTH = 50;
- const int MAPHEIGHT = 20;
- static char[,] map = new char[MAPWIDTH, MAPHEIGHT];
- public void InitMap()
- {
- for (int y = 0; y < MAPHEIGHT; y++)
- for (int x = 0; x < MAPWIDTH; x++)
- map[x, y] = '.';
- }
- public void DisplayMap(string locationName)
- {
- for (int y = 0; y < MAPHEIGHT; y++, Console.WriteLine())
- for (int x = 0; x < MAPWIDTH; x++)
- Console.WriteLine(map[x, y]);
- Console.Read();
- }
- public void AddRoom(char wall, char floor, int w, int h, int xpos, int ypos)
- {
- for (int y = 0; y < h; y++)
- for (int x = 0; x < w; x++)
- map[x + xpos, y + ypos] = x == 0 || x == w - 1 || y == 0 || y == h - 1 ? wall : floor;
- }
Advertisement
Add Comment
Please, Sign In to add comment