Can someone please help me. I am working on exercise 5.4/5.5 where I'm trying to make the piano keys alternate between up and down. Here is the code that I'm copying directly from the book and I keep getting an error of "Cannot find symbol variable isDown"
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
public class Key extends Actor
{
/**
* Create a new key.
*/
public Key()
{
}
/**
* Do the action for this key.
*/
public void act()
{
if ( !isDown && Greenfoot.isKeyDown("g") )
{
setImage ("white-key-down.png");
isDown = true;
}
if ( isDown && !Greenfoot.isKeyDown("g") ) {
setImage ("white-key.png");
isDown = false;
}
}
}

