I have one class under World that's called Maps and it's purpose is to set different worlds. I have other Classes that is Map1, Map2 and so on which add objects to the world.
I call a method in Maps that's called nextLevel that I want to use to load Map1, Map2 and so on. I do this with:
World name = new Map2();
Greenfoot.setWorld(name);
The problem here is that I want the variable "name" to be dynamic, I want it so that the first time I run nextLevel it's setWorld(Map2) and the time after it shoud run setWorld(map3) and so on. I want to be able to use a String to define what's the next setWorld is going to be. I have tried to use forName but it seems to only work for Classes and Objects. What's the easiest solution here?
Sorry if my explanation is not enough, just ask if something is not clear.

