I gave background music with the functions to play and pause but can i control this from an actor?


private GreenfootSound bgm = new GreenfootSound("insert file name here"); //function to make bgm play public void playBGM() { bgm.play(); } public void stopBGM() { bgm.stop(); }
(World class name) world; //This registers the world, so that you can use the world's function public void addedToWorld(World w) { //Typecasting, replace World class name with whatever the name of your world class. for example, put AynRandSucks if you named the world AynRandSucks world = (World class name) w; } //and then if you wish to manipulate the bgm, simply use world.playBGM() or whatever function name you have given to achieve your goal.