Hi
I created a simple game and I need to see if my knight (knight class) has killed all the enemies (enemy class). If so the game goes to the win screen, if not the game must continue. How can I do this?
public void defend()
{
Actor Enemy;
Enemy = getOneObjectAtOffset(0, 0, Enemy.class);
if (Enemy!=null)
{
World world;
world = getWorld();
world.removeObject(Enemy);
}
if (getObjects(Enemy.class).isEmpty)
{
Greenfoot.stop();
getWorld().setBackground(new GreenfootImage("game-won.JPG"));
}
}
