Moving an ellipse in all four corners

Hello, so im kinda struggling with creating an ellipse that moves around in a square movement. It must start in the top-left corner, and move towards the top-right, then moves to the bottom, then to the bottom-left, and finally moves upwards to its original position, and never stops doing so. I was only able to move the ball on one side, Im not sure what to do next, I hope someone can help me with it, thank you!

int x,y,z,w;


void setup() {
  size(500,500);
}

void draw() {
  background(155);
z=40;
w=40;
  ellipse(z+x,w+y,50,50);
  x=x+1;
  move();
  display();
  
 
}


void move() {
  x = x + 1;
  if (x > 400) {
    y=y+1;
    x = 0;
   
  }
}

Hi Jerome,

You need to post your attempt if you want some help.

Studio.ProcessingTogether.com/sp/pad/export/ro.9DEx177ceWoBc

1 Like