# Having an object fall down from top of screen from random x value

**URL:** <https://discourse.processing.org/t/having-an-object-fall-down-from-top-of-screen-from-random-x-value/4150>\
**Category:** Coding Questions\
**Created:** [October 5, 2018, 12:16am UTC](https://discourse.processing.org/t/having-an-object-fall-down-from-top-of-screen-from-random-x-value/4150 "2018-10-05T00:16:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![help.me](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@help.me](https://discourse.processing.org/u/help.me)\
**Post date:** [October 5, 2018, 12:16am UTC](https://discourse.processing.org/t/having-an-object-fall-down-from-top-of-screen-from-random-x-value/4150/1 "2018-10-05T00:16:42Z")

</div>

I’m currently making a game where numbers are supposed to fall from the top of the screen to the bottom. But i’m having trouble getting the numbers fall from random values from the top of the screen to the bottom. Can anyone help me?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [October 5, 2018, 1:13am UTC](https://discourse.processing.org/t/having-an-object-fall-down-from-top-of-screen-from-random-x-value/4150/2 "2018-10-05T01:13:19Z")

</div>

you can print a number to a empty screen with  
**text(“3”,posx,posy);**  
and increase posy in every loop  
but first need to setup a random posx.  
**posx=random(10,width-10);**  
see also [here](https://www.openprocessing.org/sketch/602202)

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [October 5, 2018, 1:57am UTC](https://discourse.processing.org/t/having-an-object-fall-down-from-top-of-screen-from-random-x-value/4150/3 "2018-10-05T01:57:21Z")

</div>

Post what code you have so far.
