This site requires JavaScript, please enable it in your browser!
Greenfoot back
Mint_Green
Mint_Green wrote ...

2014/3/5

can someone help me

Mint_Green Mint_Green

2014/3/5

#
Hi I have this game. I want to make levels when the user eats all of the certain objects existing in level 1., when they eat all of them I want greenfoot to spawn new worms and make them faster.
Pointifix Pointifix

2014/3/5

#
get the number of your worms, if they are zero, increase your level and maybe set the speed of the worms proportional to your worms.
danpost danpost

2014/3/5

#
Then you want something like the following in the act method of your subclass of World:
if (getObjects(FoodOne.class).isEmpty() &&
    getObjects(FoodTwo.class).isEmpty() &&
    getObjects(FoodThree.class).isEmpty())
{
    level++;
    spawnNewFood();
}
where the 'spawnNewFood' method can use the level number to determine how many of what to add to the world.
You need to login to post a reply.