Hi guys,
trying to check for edge of objects, this is what I have:
Edit: I can get it to say ground or no ground but I am trying to switch direction based on the shared.facingRight variable. Where am I going wrong with it?
private void checkEdge()
{
int spriteHeight = getImage().getHeight();
int lookForGround = (int)(spriteHeight/2);
Actor edge = getOneObjectAtOffset(0, lookForGround, Brick.class);
if (edge == null)
{
if (shared.facingRight == false) shared.facingRight = true;
else if(shared.facingRight == true) shared.facingRight = false;
System.out.println("no ground");
}
else
{
if (shared.facingRight == false) shared.facingRight = true;
else if(shared.facingRight == true) shared.facingRight = false;
System.out.println("ground");
}
}
