I am trying to make the enemy move directions at the edge of the screen to move right and then go down then left and continue.
Plz help!
It's quite long but I would appreciate any help Thnx!
public boolean right = true;
public boolean down = false;
public void toggleRight()
{
if(right == true)
{
right = false;
}
}
public void toggleLeft()
{
if(right == false)
{
right = true;
}
}
public void movementBoundaries()
{
if(getX()==0)
{
down = true;
}
if(getX() == 599)
{
down = true;
}
}
public void movement()
{
if(right == true)
{
move(5);
}
if(down == true)
{
setLocation(getX(), getY() + 5);
if(right == true){
toggleRight();
move(-5);
down = false;
}
if(right == false){
toggleLeft();
move(5);
down = false;
}
}
if(right == false)
{
move(-5);
}
}
