public void Main(string[] args) { Board board = new Board(25, 25); //Player Object. GameObject o1 = new GameObject("Wall"); o1.Posx = 1; o1.Posy = 1; board.addObject(o1); GameObject o2 = new GameObject("Player"); o2.Posx = 4; o2.Posy = 8; board.addObject(o2); GameObject o3 = new GameObject("Enemy"); o3.Posx = 9; o3.Posy = 5; board.addObject(o3); board.displayBoard(); Console.ReadLine(); }
//Replaces a single object in a list public void addObject(GameObject o, int list) { GameObjects[list][o.posX][o.posY] = o; }
public void addObject(GameObject o) { board[o.Posx - 1][o.Posy - 1] = o; }
public void DisplayFloor() { GameObject o1 = new GameObject("Wall", 0, 1); board.addObject(o1, 0); GameObject o2 = new GameObject("Sign", 2, 2); board.addObject(o2, 0); GameObject o3 = new GameObject("Floor", 5, 5); board.addObject(o3, 1); GenerateBackground(); foreach (List<GameObject> sublist in decorObjects) { foreach (GameObject Object in sublist) { if (Object.name == "Wall") { PictureBox imageControl = new PictureBox(); imageControl.Width = 32; imageControl.Height = 32; imageControl.Location = new Point(posx, posy); //imageControl.BackColor = Color.Transparent; background.Controls.Add(imageControl); } else if (Object.name != "Wall" && Object.name != "EMPTY") { PictureBox imageControl = new PictureBox(); imageControl.Width = 32; imageControl.Height = 32; imageControl.Location = new Point(posx, posy); imageControl.Image = (Image)checkName(Object.name); imageControl.BackColor = Color.Transparent; background.Controls.Add(imageControl); } posx += 32; } posx = 0; posy += 32; } posx = 0; posy = 0; foreach (List<GameObject> sublist in gameObjects) { foreach (GameObject Object in sublist) { if (Object.name != "EMPTY") { PictureBox imageControl = new PictureBox(); imageControl.Width = 32; imageControl.Height = 32; imageControl.Location = new Point(posx, posy); //imageControl.BackColor = Color.Transparent; background.Controls.Add(imageControl); } posx += 32; } posx = 0; posy += 32; } }