I am creating an open world game, where each "place" is made up of "sub-places"
For example, I have Farm.java class
that is graphically represented by a matrix of sub-places : a house, a pond, a garden, and a field, and the user can "move" through this matrix and interact with the different places.
So, in a Farm
object I want a sub-place matrix/array that contains a house object, a pond object, a garden object, and a field object (all different classes). I would like to do the following:
SubPlace[][] map = new SubPlace[1][1]
but I cannot do this because there is no actual SubPlace.java
class, and I am not sure how to push these different objects into the same matrix.
I want the matrix to look like this:
map[0][0]= new House();
map[0][1]= new Pond();
map[1][0]= new Field();
map[1][1]= new Garden();
How can i do this when these are all different classes? Do they need to extend/inherit/or something from a common SubPlace class? Or is there another way to push all those objects in the matrix?