# How to make bouncing balls?

**URL:** <https://discourse.processing.org/t/how-to-make-bouncing-balls/15465>\
**Category:** Coding Questions\
**Created:** [November 13, 2019, 5:23pm UTC](https://discourse.processing.org/t/how-to-make-bouncing-balls/15465 "2019-11-13T17:23:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soloh](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Soloh](https://discourse.processing.org/u/Soloh)\
**Post date:** [November 13, 2019, 5:23pm UTC](https://discourse.processing.org/t/how-to-make-bouncing-balls/15465/1 "2019-11-13T17:23:34Z")

</div>

i have to do ball Flying left, and when it reach wall it return

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 13, 2019, 5:42pm UTC](https://discourse.processing.org/t/how-to-make-bouncing-balls/15465/2 "2019-11-13T17:42:00Z")

</div>

Hello, and welcome to the forum!

Nice to have you here.

You need a Sketch with setup and draw.

Please use ellipse command to draw a circle:

ellipse (100,100,10,10);

See reference

Then replace the y value with a variable y and say `y--;`

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 22, 2019, 4:54pm UTC](https://discourse.processing.org/t/how-to-make-bouncing-balls/15465/3 "2019-11-22T16:54:38Z")

</div>

> [@Soloh](#):
>
> ball Flying left, and when it reach wall it return

Processing has several “bouncing” examples:

- [Bounce / Examples / Processing.org](https://processing.org/examples/bounce.html)
- [Bouncing Ball with Vectors / Examples / Processing.org](https://processing.org/examples/bouncingball.html)

The term for knowing when to bounce is “collision detection.” You can find several good tutorials on collision detection in Processing with examples, here is one:

> **[Collision Detection](http://www.jeffreythompson.org/collision-detection/)**
>
> An online book about collision detection using Processing.
