Hello, I know this is likely an extremely elementary issue but I can not figure it out for the life of me, I am attempting to create a system to make a sprite loop to the left of the screen when they hit the right side. I will put the code below; assistance is very welcome. Thank you
Code: (For context my world is 600x400))
public void act()
{
move (3);
if(atEdge())
{
setLocation (0,200);
}
}
public boolean atEdge()
{
if (getX() < 0)
{
return true;
}
if (getX() > 599)
{
return true;
}
if (getY() < 0)
{
return true;
}
if (getY() > 399)
{
return true;
}
return false;
}
}

