Try adding the following as line 31:
Now I see more changed posts. If it works then the above is unnecessary.
getWorld().removeObject(this);
getWorld().removeObject(this);
getWorld().removeObject(this);
public void act()
{
theEndGame(); // the code is beign called here
}
public void birdDead() {}// remove this method
public void silentBirdDead() {} // remove this method
private void theEndGame()
{
//Falls off the background.
if (getY() >= getWorld().getHeight()-1 && getWorld().getObjects(GameOver.class).isEmpty())
{
getWorld().addObject(new GameOver(), getWorld().getWidth()/2,getWorld().getHeight()/2);
if (GameMusic.isPlaying())
{
GameMusic.stop();
Greenfoot.playSound("sfx_hit.wav");
Greenfoot.playSound("MBGameOver.mp3");
}
}
}public void act()
{
theEndGame(); // the code is beign called here
}
public void birdDead() {}// remove this method
public void silentBirdDead() {} // remove this method
private void theEndGame()
{
//Falls off the background.
if (getY() >= getWorld().getHeight()-1 && getWorld().getObjects(GameOver.class).isEmpty())
{
getWorld().addObject(new GameOver(), getWorld().getWidth()/2,getWorld().getHeight()/2);
if (GameMusic.isPlaying())
{
GameMusic.stop();
Greenfoot.playSound("sfx_hit.wav");
Greenfoot.playSound("MBGameOver.mp3");
}
}
}