Hey guys, I am having problems trying to turn on the music in my world after having just turned it off... The part I don't know how to code it to check whether the music is on or off yet in my if statement....
public class BalloonWorld extends World
{
MainMenu mainMenu = new MainMenu();
private GreenfootSound bgMusic = new GreenfootSound("OldFriends.wav");
/**
* Constructor for objects of class MainMenu.
*
*/
public BalloonWorld()
{
// Create a new world with 800x600 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
background();
bgMusic.play();
GreenfootSound.isPlaying(true);
}
public void background()
{
setBackground("background.jpg");
}
public void act()
{
options(); // gives the image with turning on off sound instructions
instructions(); //image with instructions is put up
start(); // changes to the actual game world
back(); //takes user back to the main menu
}
public void options()
{
if (Greenfoot.isKeyDown("o"))
{
addObject(new Options(), 400, 300);
}
if (Greenfoot.isKeyDown("f"))
{
bgMusic.stop();
}
if (Greenfoot.isKeyDown("n") && (GreenfootSound.isPlaying(false)))
{
bgMusic.play();
}
}

