I want to check wether an actor is between both ends of another actor with caring about their graphical extend. It doesn't work, but I don't know why.
public boolean onActor(Actor p){ if(p!=null){ int links = p.getX()-p.getImage().getWidth()/2; int rechts= p.getX()+p.getImage().getWidth()/2; if(links<=getX()-getImage().getWidth()/2) return true; if(rechts>=getX()+getImage().getWidth()/2) return true; } return false; }