I am building simple java game which the user has to find gold. There are some obstacles like Orc, Goblin, and Poop.
What I am trying to do is that I am creating Cell and Board class.
Inside of my Cell class,
public Cell{
public enum TheCell { Orc, Goblin, Poop, Gold, Empty};
TheCell type;
public Cell(TheCell type){
this.type = type;
}
}
and I make two dimensions in Board class,
public Board{
Cell[][] grid = new Cell[7][7];
Random r = new Random();
for(int i = 0; i<3; i++){
int randNum1 = r.nextInt(7);
int randNum2 = r.nextInt(7);
grid[randNum1][randNum2] = new Cell(Cell.TheCell.Orc);
}
for(int i = 0; i<3; i++){
int randNum1 = r.nextInt(7);
int randNum2 = r.nextInt(7);
grid[randNum1][randNum2] = new Cell(Cell.TheCell.Goblin);
}
}
My question is that, in case of Orc and Goblin are same cell, I wanna keep them both monster in same cell. Is there some how I can keep both or multiple obstacles in same cell? Thank you!