My character only turns when it hits one wall but doesn't turn when it hits the other. Help please!
Here's the code that i have:
public void act()
{
moveAround();
}
public boolean hitWall()
{
if (isTouching (wall.class))
{
return true;
}
else
{
return false;
}
}
public void moveAround()
{
move(3);
if(isTouching (wall.class)==true)
{
move(-3);
int i = Greenfoot.getRandomNumber(3);
if(i==1)
{
setRotation(180);
i=0;
}
if(i==2)
{
setRotation(180);
i=0;
}
}
}

