I am making a frogger game and have come to a bit of a stand still, I am trying to get the lilypads to go in different directions, not all the same way across the screen, and also in different speeds, this is what I have so far, but it is glitchy and everytime it moves it visibly looks bad, here is my code for it so far...
public static int direction;
public void act()
{
if (atWorldEdge())
{
if(direction <0)
{
setLocation(605, getY());
}
else
{
setLocation(20, getY());
}
}
move(Greenfoot.getRandomNumber(15));
}

