How can i use..... isKeyDown method. Could someone give me an example to use isKeyDown method.
Is there a way to practice Greenfoot API ?
Most of the time i got errors.
private void checkKeys()
{
if (Greenfoot.isKeyDown("left") )
{
setImage("pengu-left.png");
moveLeft();
}
if (Greenfoot.isKeyDown("right") )
{
setImage("pengu-right.png");
moveRight();
}
if (Greenfoot.isKeyDown("space") )
{
if (onGround())
jump();
}
}