I want to let enemy check if there's a platform above it and when it's above it, then let him jump. But I want it to only jump when it sees the platform. Here is my code that doesn't work, I hope someone can help me out:
public boolean checkAbove()
{
Actor ground = getObjectsInRange(10);
if (ground != null)
{
System.out.println("true" );
return true;
}
System.out.println(ground);
return false;
}
public void jump()
{
if (checkAbove())
{
vSpeed = vSpeed - jumpStrength;
jumping = true;
fall();
}
}
