# I am making a game but i cant figure out how to keep the ellipse inside the window. how do i do this?

**URL:** https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757
**Category:** Coding Questions
**Created:** [April 30, 2021, 8:10pm UTC](https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757 "2021-04-30T20:10:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)
#### Post date: [April 30, 2021, 8:10pm UTC](https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757/1 "2021-04-30T20:10:19Z")

</div>

float x =0;  
float y =0;  
float snelheid\_omlaag = 1;  
;void setup()  
{  
fullScreen();  
}

void draw()  
{

ellipse(x, y, 50, 50);  
x=x+random(-90, 90);  
y=y+random(-40, 40)+snelheid\_omlaag;  
i want the keep inside window code here  
}

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [April 30, 2021, 8:34pm UTC](https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757/2 "2021-04-30T20:34:41Z")

</div>

Hi @MoonAlien822 ,

Welcome to the forum! 😉

Please format your code by using the `</>` button when editing a message or put backticks around your code like this : ``` code``` → `code`

Also it’s better to put the content of your question in the body of the message, not the title! 😀

If you want the ellipse to stay in the window, try to think in pixels and coordinates. What does that mean if a circle is outside the visible screen?

You can easily make a drawing on paper and try to see which information you have in order to solve that.

About the coordinate system and shapes, there’s this tutorial on the Processing website :

[https://processing.org/tutorials/drawing/](https://processing.org/tutorials/drawing/)
