For my Jump and Run I need a method that checks, wether an object is below the actor or not. It looks like this:
But it is ugly. If the Player falls with one pixel per act, he will stop falling four pixels above the bottom and if he is faster than 5 pixels per act, he falls through the my bootom objects. I know why it works this way, but I don't know how to make this method better. Any ideas?
public boolean objectBelow(Class clss)
{
Actor a1 = getOneObjectAtOffset(0, (getImage().getHeight()/2), clss);
Actor a2 = getOneObjectAtOffset(0, (getImage().getHeight()/2)+1, clss);
Actor a3 = getOneObjectAtOffset(0, (getImage().getHeight()/2)+2, clss);
Actor a4 = getOneObjectAtOffset(0, (getImage().getHeight()/2)+3, clss);
Actor a5 = getOneObjectAtOffset(0, (getImage().getHeight()/2)+4, clss);
if(a1!=null||a2!=null||a3!=null||a4!=null||a5!=null){
return true;
}
return false;
}


