Hi!
I'm working on a game for a beginner programming course and I'm struggling to end the game and have my score counter/end game screen pop up!
All codes I've seen for this issue are useful when one enemy dies (before the removeObject code on the death method) but I have five enemies and obviously don't want the game to end until all five are killed.
Here is my code:
/**
* If NegaDoge runs out of life, then he dies!
*/
private void die()
{
Greenfoot.playSound("au.wav");
getWorld().removeObject(this);
if (NegaDoge.class == null)
{
DogeWorld dogeWorld = (DogeWorld) getWorld();
ScoreBoard scoreboard = new ScoreBoard();
getWorld().addObject (scoreboard, dogeWorld.getWidth()/2, dogeWorld.getHeight()/2);
}
}/
It compiles, but it doesn't work after I've killed all the enemies.