When trying to use Greenfoot.ask() in the world constructor, it works the first time. If you exit Greenfoot and then go back in, it
no longer works. Instead, the line appears to just get skipped! It has nothing to do with the fact that I convert the string to an int... prompt for input
just doesn't even appear if you try to run it again after exiting.
public void populateWorld()
{
addObject(new Crab(), 300, 300);
addObject(new Lobster(), 90, 70);
addObject(new Lobster(), 390, 200);
addObject(new Lobster(), 360, 500);
String x = Greenfoot.ask("How many worms?"); //seems to only work the first time.
int worms = Integer.parseInt(x);
for (int i=0; i < worms; i++)
addObject(new Worm(), Greenfoot.getRandomNumber(560), Greenfoot.getRandomNumber(560));
}
