This code will loop the music when the scenario is running. Change "filename.filetype" to your music file saved in the sounds folder. Place the code into your active world.
private GreenfootSound bgMusic = new GreenfootSound("filename.filetype");
public void started()
{
bgMusic.playLoop();
}
public void stopped()
{
bgMusic.pause();
}