I'm very new to greenfoot and I am supposed to get a thing to move when i press a certain key. When I write this code below the thing moves without me pressing any key, it just doesn't react to me pressing it. What have done wrong?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Banan here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Banan extends Mat
{
public void act()
{
checkKeypress();
}
public void checkKeypress()
{
if(Greenfoot.isKeyDown("left"));
{
setLocation(getX()+1, getY());
}
if(Greenfoot.isKeyDown("right"));
{
setLocation(getX(), getY());
}
}