anonymousse wrote...
That worked thank you. If I would change the dimensions to 'super(24, 24, 25), would that mean that my cells are in a dimension of 25 then?
super(8, 8, 125); for (int y=0; y<8; y++) for (int x=0; x<8; x++)
public void act() {
move();
}
public void move()
{
move(0);
if (Greenfoot.isKeyDown("left"))
{
move(-1);
}
if (Greenfoot.isKeyDown("right"))
{
move(1);
}//
setRotation(90);
if (Greenfoot.isKeyDown("up"))
{ move(-1); }
if (Greenfoot.isKeyDown("down"))
{ move(1); }
setRotation(0);
}
}public void move()
{
String key = Greenfoot.getKey();
int dx = 0, dy = 0; // the offsets from current location
if ("up".equals(key)) dy--;
if ("down".equals(key)) dy++;
if ("left".equals(key)) dx--;
if ("right".equals(key)) dx++;
setLocation(getX()+dx, getY()+dy);
// check for illegal movement here and reset location adding negative offsets
}