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

2013/5/2

Enemies Help

SWAG SWAG

2013/5/2

#
How can I make it so that I cant go to level 2 unless the all my enemies are killed? Please help with the code.
danpost danpost

2013/5/3

#
In the act method of your active world class, if the list returned from using the 'getObjects(Enemy.class)' is empty then do what you need to do to set up the next level (presuming that 'Enemy' is the name of your class that your enemies are created in).
SWAG SWAG

2013/5/3

#
danpost wrote...
In the act method of your active world class, if the list returned from using the 'getObjects(Enemy.class)' is empty then do what you need to do to set up the next level (presuming that 'Enemy' is the name of your class that your enemies are created in).
I don't understand, can you be more specific.
danpost danpost

2013/5/3

#
In your world class act method:
if (getObjects(Enemy.class).isEmpty())
{
    // create level 2
}
SWAG SWAG

2013/5/3

#
it worked thxs
You need to login to post a reply.