Hello,
I know you can concatenate some String, but I wanted to know, is there a way to concatenate a method ?
For example, I have a game with many levels. When you finish a level, I set in the world :
Then in the nextLevel code :
I want to know if I set in a String with the name of the next level, can I put it in the act method to go on the next ? I dont really want to create so many class for different buttons with only that little change.
Thanks a lot !
addObject(new nextLevel("Level2"), 50, 100);public class nextLevel extends Bouton
{
private String thisL;
public nextLevel(String whichL)
{
thisL = whichL;
beBouton("Good job ! here for the next level");
}
public void act()
{
if(Greenfoot.mouseClicked(this))
{
Btn.setTransparency(255);
Greenfoot.setWorld(new ...());
}
}
}

