So I have this class called zwarteBalk:
And in the class below named GravityUp, I try to use the method checkKeys() from zwarteBalk with
It doesn't work.. What am I doing wrong?
import greenfoot.*;
public class zwarteBalk extends Actor
{
public void act()
{
checkKeys(7);
}
public void checkKeys(int speed)
{
if(Greenfoot.isKeyDown("right"))
{
setLocation(getX()-speed,getY());
}
if(Greenfoot.isKeyDown("left"))
{
setLocation(getX()+speed,getY());
}
}
}zwarteBalk balk = new zwarteBalk();
balk.checkKeys(7);import greenfoot.*;
public class GravityUp extends Actor
{
public void act()
{
zwarteBalk balk = new zwarteBalk();
balk.checkKeys(7);
}
}

