# Making Box appear in random locations

**URL:** <https://discourse.processing.org/t/making-box-appear-in-random-locations/32458>\
**Category:** Coding Questions\
**Created:** [September 28, 2021, 2:56am UTC](https://discourse.processing.org/t/making-box-appear-in-random-locations/32458 "2021-09-28T02:56:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zack10](https://avatars.discourse-cdn.com/v4/letter/z/5e9695/32.png) [@zack10](https://discourse.processing.org/u/zack10)\
**Post date:** [September 28, 2021, 2:56am UTC](https://discourse.processing.org/t/making-box-appear-in-random-locations/32458/1 "2021-09-28T02:56:04Z")

</div>

```auto
class Box{
  float z = 50;
  float dz = 2;
  
  void moveBox()
  {
    z += dz;
  }
  
  void show()
  {
    lights();
    pushMatrix();
    translate(130, 220, z);

    noStroke();
    fill(10, 98, 240);
    rotateX(frameCount / 100.0);
    rotateY(frameCount / 100.0);
    box(40);
    popMatrix();

    if(z+30 >height || z-30 <0)
    {
      dz *=-1;
    }
  }
 
}

```

---

<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:** [September 28, 2021, 9:27am UTC](https://discourse.processing.org/t/making-box-appear-in-random-locations/32458/2 "2021-09-28T09:27:52Z")

</div>

> [@Guidelines—Asking Questions](https://discourse.processing.org/t/guidelines-asking-questions/2147):
>
> Summary (TL;DR) Ask complete questions to get better answers! Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas. Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want. Can we run your code to …

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [September 28, 2021, 10:18am UTC](https://discourse.processing.org/t/making-box-appear-in-random-locations/32458/3 "2021-09-28T10:18:17Z")

</div>

Hello @zack10,

There are resources here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

`:)`
