I am trying to make a sound that will start then stop when the game ends.
My code below:
My problem is that when the game ends the music doesn't stop.
Any help will be much appreciated.
GreenfootSound sound = new GreenfootSound("music.wav"); GreenfootSound sound2 = new GreenfootSound("death.wav"); if(playno == 1) { sound.play(); playno++; } if(canSee(Player.class)) { eat(Player.class); sound.stop(); Greenfoot.stop(); }