private void movement() { int x = getX(), y = getY(), dir = getRotation(); if (Greenfoot.isKeyDown("left") && x > 10) { setLocation(x - 7, y); setRotation(Math.max(dir - 2, 247)); starsDir(); } else if (Greenfoot.isKeyDown("right") && x < 794) { setLocation(x + 7, y); setRotation(Math.min(dir + 2, 293)); starsDir(); } else { setRotation((int) Math.round(-(dir - 270) / 1.8) + dir); starsDir(); } x = getX(); if (Greenfoot.isKeyDown("up") && y > 70) { setLocation(x, y - 7); } else if (Greenfoot.isKeyDown("down") && y < 660) { setLocation(x, y + 7); } }