yes i do have a field
the code looks likes this now
GreenfootSound backgroundMusic = new GreenfootSound("Controlecentrum.mp3");
backgroundMusic.playLoop();
yes i do have a field
the code looks likes this now
GreenfootSound backgroundMusic = new GreenfootSound("Controlecentrum.mp3");
backgroundMusic.playLoop();
I will presume that these lines are in a method of your World subclass. If those two lines are back-to-back inside a method, then that is a local field and is not good enough. You need to move the first line outside the method to make it a 'global' field (an instance field -- one that belongs to the object that creates it; not one that belongs to the method, where it is discarded after the method is done executing). After you move the first line to outside the method, you should be able to use:
on the world object. What I mean by 'on the world object' is this: if you are trying to stop it from an Actor subclass, you would need something like this: