I've been trying to get an actor of mine to get the location of another actor. I've attempted to use the getX() and getY() commands but it hasn't been working. I read somewhere that first the the actor that I want the location of has to be initialised, but I don't know what that means exactly. This is the code that I have so far:
public class FalsePopup extends BattleArrow
{
/**
* Act - do whatever the FalsePopup wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setImage(new GreenfootImage("FALSE!", 35, Color.WHITE, Color.BLACK));
setTransparency();
}
public void setTransparency()
{
getImage().setTransparency(0);
}
public void setTransparencyCheck()
{
if (BattleArrow.getX()==325 && BattleArrow.getY()==335 && "enter".equals(Greenfoot.getKey()))
{
getImage().setTransparency(0); //I'm trying to set the text to be invisible if the above condition is met
Wait for a few seconds //Still trying to work out this part of the code
}
}
}

