Hello I'm new at green foot and need some help I want to code it so that a sound is play every other click. How would I do that?
here is what I have so far. I think you should set a variable to hold a count so when the sound play time will be 1. I'm just kind of confuse.
public void sound()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
GreenfootSound gfs1 = new GreenfootSound("Beep.wav");
int time = 0;
if (Greenfoot.mouseClicked(this))
{
if (mouse.getButton() == 1) // Left mouse pressed?
{
gfs1.play();
time = time + 1;
}
}
}