public void createStaticGrid(DungeonEnum[,] grid) { tiles = new Tile[mNumRows, mNumColumns]; // Rows for (int i = 0; i < mNumRows; i++) { // Columns for (int j = 0; j < mNumColumns; j++) { // tiles[i, j] = new Tile(rand); tiles[i, j] = new Tile(grid[j, i]); } } }
// Methods public void drawTiles(Tile[,] tiles, Graphics g) { graphics = g; int indexX = 0, indexY = 0; // indexes int height = 75; int width = 75; Image image; for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { Brush borderColor = tiles[indexX, indexY].getBorderColor(); Brush bgcolor = tiles[indexX, indexY].getBackgroundColor(); // Needs to get the itemType and based on that draw an item //Item[] items = tiles[indexX, indexY].getItems(); DungeonEnum itemType = tiles[indexX, indexY].TileType; Boolean hasItem = tiles[indexX, indexY].hasItem(); //Console.WriteLine("APPLES " + indexX + " " + indexY + " " + tiles[indexX, indexY].getBorderColor().ToString()); //Brush borderColor = Brushes.Black; //Brush bgcolor = Brushes.Orange; graphics.DrawRectangle(new Pen(borderColor, 5), ((height + 10) * x) + 20, ((width + 10) * y) + 20, width, height); graphics.FillRectangle(bgcolor, ((height + 10) * x) + 20, ((width + 10) * y) + 20, width, height); // Random r = new Random(); //int rand = r.Next() % 100; // if (rand % 2 != 0) { // if (hasItem) //items[0].getItemImagePath() != null { // Image image = Image.FromFile(items[0].getItemImagePath()); //graphics.DrawImage(image, ((height + 10) * x) + 20, ((width + 10) * y) + 20, 20, 20); // Gem size if (itemType == DungeonEnum.WALL) { image = wall2; graphics.DrawImage(image, ((height + 10) * x) + 20, ((width + 10) * y) + 20, 75, 75); } if (itemType == DungeonEnum.ITEM) { image = treasureItemImage; graphics.DrawImage(image, ((height + 10) * x) + 20, ((width + 10) * y) + 20, 30, 30); } } if (itemType == DungeonEnum.DRAGON) { image = dragonImage; graphics.DrawImage(image, ((height + 10) * x) + 20, ((width + 10) * y) + 20, 75, 75); } } indexY++; } indexX++; indexY = 0; } graphics.DrawRectangle(new Pen(Brushes.Khaki, 5), 10, 10, ((height) * 5) + 60, ((width) * 5) + 60); }