Doing an animation that requires a boulder to roll down a hill, then go to the right of the screen, then go back left and up the hill and stop. But once I get to the BoulderRollRight I cant go roll the boulder left because the condition in the if statement in the BoulderRollRight is still being met. How can I change it so the condition is met once it reaches the end then stops so it goes left

Here is my code:

```
float x = 70;
float y = 200;
int r =0;
float speedx = 2;
float speedy = 2;
void setup()
{
myBackground();
size(800, 500);
boulderDownHill();
}
void myBackground()
{
background(#16A1F5);
fill(#624909);
stroke(#18C949);
strokeWeight(5);
rect(-4, 350, 807, 155);
stroke(#18C949);
strokeWeight(5);
fill(#18C949);
triangle(-1, 180, -1, 350, 200, 350);
stroke(#EBF00A);
fill(#EBF00A);
ellipse(60, 50, 40, 40);
}
void draw()
{
myBackground();
boulderDownHill();
fill(#5F6239);
strokeWeight(1);
stroke(#5F6239);
ellipse(-10-speedx, -10-speedy, 50, 50);
arc(-10-speedx, -10-speedy, 60, 60, 0, PI+QUARTER_PI, PIE);
fill(0);
ellipse(-5-speedx, -5-speedy, 10, 10);
ellipse(-30-speedx, -5-speedy, 10, 10);
translate(x, y);
}
void boulderDownHill()
{
if (y<330)
{
x=x+2;
y=y+1.5;
translate(x, y);
rotate(radians(r));
r+=2;
translate(20, 20);
}
else if(y>=330){
BoulderRollRight();
}
}
void BoulderRollRight()
{
if(x<750)
{
x=x+2;
translate(x, y);
rotate(radians(r));
r+=2;
translate(20, 20);
}
else if(x>=750)
{
boulderRollLeft();
}
}
void boulderRollLeft()
{
if(x>330)
{
x=x-5;
translate(x, y);
rotate(radians(r));
r+=2;
translate(20, 20);
}
}
```

Another optional question is how would I get the boulder to slow down its movement?