How would i stop a program from running 2 worlds at once?
After my world hits its game over....i initiate the world again, which means that there are 2 worlds running. How would i remove one of them? (Preferably through an actor class)
if(!backgroundMusic.isPlaying())
{
backgroundMusic.play();
}GreenfootSound backgroundMusic = new GreenfootSound("Theme.mp3");
public void act()
{
if (Greenfoot.isKeyDown("y"))
{
backgroundMusic.stop();
Greenfoot.setWorld(new Level1());
}
if (Greenfoot.isKeyDown("n"))
{
backgroundMusic.stop();
Greenfoot.setWorld(new Menu());
}
}
}