Hi, I was wondering how you can make greenfoot create a new object when there are less than a certain number of them. For example, if there are less than 10 worms I want to spawn a new worm. All help is appreciated, thanks.
// at the top:
import java.util.List;
// where you want to create the new object:
List worms = getObjects(Worm.class);
if (worms.size() < 10) {
// add a new worm.
}public void act()
{
spawnWorms();
}