This may be an obvious thing I'm missing, but I want to have one object perform an action only when it is to the right of another thing.
The objects are "Hiro" and "Ykey", and I want Ykey to perform an action when it is to the right of Hiro.
Help?
// in Ykey class (part of act)
setLocation(getX()-getImage().getWidth(), getY());
Actor hiro = getOneIntersectingObject(Hiro.class);
setLocation(getX()+getImage().getWidth(), getY());
if (hiro != null)
{
// perform action here
}