My friend is coding a game and trying to get the objects to change directions as they hit the edge. why won't this code work?
public void act()
{
if(isAtEdge() && edge==0)
{
edge=1;
}
if( isAtEdge() && edge==1)
{
edge=0;
}
if (edge==0)
{
move(6);
}
if (edge==1)
{
move(-6);
}
i++;
hit();
} //I know its not supposed to be in the act method.

