In my game, when the enemy dies, it plays a death sound correctly, but when I'm trying to play a sound when my character dies, it doesn't work. The win and lose menu music doesn't work either. What is causing the problem? My guess is a Greenfoot problem with sound files.
and my error is this one:
java.lang.NullPointerException
at greenfoot.sound.SoundStream.setVolume(SoundStream.java:461)
at greenfoot.GreenfootSound.setVolume(GreenfootSound.java:129)
at GanhouW.<init>(GanhouW.java:21)
at UmJogadorW.act(UmJogadorW.java:180)
at greenfoot.core.Simulation.actWorld(Simulation.java:610)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:545)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
public GanhouW()
{
super(900, 650, 1);
prepare();
GreenfootSound win = new GreenfootSound("ganhou.wav");
//ganhou.stop();
win.setVolume(60);
win.play();
}

