hello,
i start a music in my first world, but then i change world a few times. after i arrive a certain world i want the music to stop, i want to change it
how do i do that ?
sorry if my english is bad, its not my first language lol


public static GreenfootSound bgSound;
bgSound = new GreenfootSound("intro.mp3"); bgSound.play();
MyWorld.bgSound.stop();
MyWorld.bgSound = new GreenfootSound("replacement.mp3"); MyWorld.bgSound.play();
public static void setBackgroundSound(String name) { if (bgSound != null) bgSound.stop(); bgSound = null; if (name == null) return; bgSound = new GreenfootSound(name); bgSound.play(); }
setBackgroundSound("intro.mp3");
MyWorld.setBackgroundSound("replacement.mp3);
myWorld.setBackgroundSound(null);