can anybody help with the exercise 6.36 for the Newton's lab?
I am trying to change/add codes for obstacle that gets switched on and off by being hit by a body.
private void checkToggle()
{
if (!touched && isTouching())
{
touched = true;
toggleOn = !toggleOn;
if (toggleOn)
{
setImage ("block-light.png");
Greenfoot.playSound(sound);
}
else
{
setImage ("block.png");
}
}
if (touched && !isTouching())
{
touched = false;
}
}

