Can any one tell mi what is wrong with this code? I am traying to play music buy clicking on the object ans stop it if I click again.
public GreenfootSound music = new GreenfootSound("killer.mp3");
/**
* Act - do whatever the Dugme wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
play();
stop();
}
public void play()
{
if(Greenfoot.mouseClicked(this))
{
music.playLoop();
}
}
public void stop()
{
if (music.isPlaying() && Greenfoot.mouseClicked(this))
{
music.stop();
}
}

