# Moving an ellipse in all four corners

**URL:** <https://discourse.processing.org/t/moving-an-ellipse-in-all-four-corners/4195>\
**Category:** Coding Questions\
**Created:** [October 6, 2018, 5:52pm UTC](https://discourse.processing.org/t/moving-an-ellipse-in-all-four-corners/4195 "2018-10-06T17:52:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeromeBatchoski](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@JeromeBatchoski](https://discourse.processing.org/u/JeromeBatchoski)\
**Post date:** [October 6, 2018, 5:52pm UTC](https://discourse.processing.org/t/moving-an-ellipse-in-all-four-corners/4195/1 "2018-10-06T17:52:43Z")

</div>

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!

```auto
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;
   
  }
}

```

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [October 6, 2018, 6:09pm UTC](https://discourse.processing.org/t/moving-an-ellipse-in-all-four-corners/4195/2 "2018-10-06T18:09:46Z")

</div>

Hi Jerome,

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

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 6, 2018, 6:11pm UTC](https://discourse.processing.org/t/moving-an-ellipse-in-all-four-corners/4195/3 "2018-10-06T18:11:38Z")

</div>

[Studio.ProcessingTogether.com/sp/pad/export/ro.9DEx177ceWoBc](http://Studio.ProcessingTogether.com/sp/pad/export/ro.9DEx177ceWoBc)
