Hey im having a little issue with the .setLocation method. This is what I have for my code....
when i compile I get "non - static method setLocation can not be reference from a static context". I thought this was something to do with the random number generator, but from what i have seen this is correct in greenfoot.
public void checkKeypress() { int num1 = Greenfoot.getRandomNumber(560); int num2 = Greenfoot.getRandomNumber(560); if (Greenfoot.isKeyDown("up")) { move(); } if (Greenfoot.isKeyDown("down")) { turn(180); } if (Greenfoot.isKeyDown("left")) { turn(-4); } if (Greenfoot.isKeyDown("right")) { turn(4); } if (Greenfoot.isKeyDown("space")) { Crab.setLocation(num1, num2); } }