So I have maps made of 2D arrays like so:
int[][] level1 = {
{4, 4, 4, 4, 4, 4, 4, 4, 4,}, //
{4, 4, 4, 4, 4, 4, 4, 4, 4,}, //
{4, 0, 1, 1, 4, 4, 4, 4, 4,}, //
{4, 4, 4, 1, 1, 2, 3, 4, 4,}, //
{4, 4, 4, 4, 4, 4, 4, 4, 4,}, //
{4, 4, 4, 4, 4, 4, 4, 4, 4,}, //
{4, 4, 4, 4, 4, 4, 4, 4, 4,} //
};
When I call the next level to be loaded, I access a getNextLevel class and pass the integer of the current level I am on. To make things easier on myself and not have to hard-code which level to load each time, I want to add allll of my levels into one array called Levels[], and then have my getNextLevel class look something like this:
public int[] getNextLevel(int level) {
return levels[level];
}
However, I could not get that to work. After researching on the idea, I couldn’t find anyone else who had run into the same problem. Thanks for helping :3
-Nathan