for movement you should use:
private double a = 300;
private double b = 200;
private int speed = 2;
public void act()
{
// Add your action code here.
//move(1);
int x = getX();
int y = getY();
int ww = getWorld().getWidth();
int wh = getWorld().getHeight();
if (Greenfoot.isKeyDown("up")|| Greenfoot.isKeyDown("w")) //for moving forward
{
a += Math.cos(Math.toRadians(getRotation()))*speed;
b += Math.sin(Math.toRadians(getRotation())) * speed;
a = 1+(a+(ww-3))%(ww-2);
b = 1+(b+(wh-3))%(wh-2);
setLocation((int)a, (int)b);
}
}
2013/1/2
2013/1/2
2013/1/2
2013/1/2
2013/1/2
2013/1/2
2013/1/3
2013/1/3
2013/1/3
2014/12/9
2014/12/9