Here is the method affected by the gremlins. I'm attempting to go through a range of Y values for more precise collision detection, but it only seems to return code outside of the for loop. Tested without the for loop earlier, with 0 replacing bumpY, worked fine.
public boolean turn()
{
World myWorld = getWorld();
int bumpY;
Actor bumpright;
Actor bumpleft;
for(bumpY = -10; bumpY == 10; bumpY++) {
bumpright = getOneObjectAtOffset(10, bumpY, Bumper.class);
bumpleft = getOneObjectAtOffset(-10, bumpY, Bumper.class);
if (bumpright != null && getRotation() == 0) {
setRotation(180);
return true;
}
else if (bumpleft != null && getRotation() == 180) {
setRotation(0);
return true;
}
else if(getX() >= myWorld.getWidth() - 10 && getRotation() == 0) {
setRotation(180);
return true;
}
else if (getX() <= 10 && getRotation() == 180) {
setRotation(0);
return true;
}
}
return false;
}
