I am making it so that the actor stops at walls and i have the right wall completely working but I need help with making the actor stop at the left walls, I don't know what to make inverse to fix it.
right wall codes:
---------------------------------------------------------------------------------as
---------------------------------------------------------------------------------------
any help is greatly appreciated!
public boolean checkRightWalls()
{
int spriteWidth = getImage().getWidth();
int xDistance = (int)(spriteWidth/2);
Actor rightWall = getOneObjectAtOffset (xDistance, 0, Ground.class);
if(rightWall == null)
{
return false;
}
else
{
stopByRightWall (rightWall);
return true;
}
}
public void stopByRightWall (Actor rightWall)
{
int wallWidth = rightWall.getImage().getWidth();
int newX = rightWall.getX() -(wallWidth + getImage().getWidth())/2;
setLocation(newX -3, getY());
}
