I'm making an object that is meant to change image when HitDetect() returns true, and also set transparency to 0 when the object is at the edge, but I can't get it to do both.When I run this, the second if works fine but the first doesn't and when I remove the second one, the first works fine. Help?
if (getY() <= 1 || getX() <= 1 || getY() >= 599 || getX() >= 799)
{
getImage().setTransparency(0);
}
else
{
getImage().setTransparency(255);
}
if (hitDetect() == true)
{
setImage(new GreenfootImage("TowerCopy.png"));
}
else
{
setImage(new GreenfootImage("Tower.png"));
}

