# Not using Classes or Translate

**URL:** https://discourse.processing.org/t/not-using-classes-or-translate/32161
**Category:** Coding Questions
**Created:** [September 9, 2021, 7:31am UTC](https://discourse.processing.org/t/not-using-classes-or-translate/32161 "2021-09-09T07:31:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![UnsureNeedHelp](https://avatars.discourse-cdn.com/v4/letter/u/ce73a5/32.png) [@UnsureNeedHelp](https://discourse.processing.org/u/UnsureNeedHelp)
#### Post date: [September 9, 2021, 7:31am UTC](https://discourse.processing.org/t/not-using-classes-or-translate/32161/1 "2021-09-09T07:31:45Z")

</div>

Hey all!

I’ve got code here but we’ve not been allowed to use classes or transformations such as rotate, translate, scale etc. I really need help making this code work with these rules. Not sure where to even start, any help would be heavily appreciated.

code here:

````auto
class Star {
  float x;
  float y;
  float z;
  
  Star() {
    x = random(-width, width);
    y = random(-height, height);
    z = random(width);
  } 
  
void update() {
  z = z - 1;
  if (z < 1) {
    z = width;
    x = random(-width, width);
    y = random(-height, height);
  }
} 

void show() {
  fill(255);
  noStroke();
  
  float sx = map(x / z, 0, 1, 0, width);
  float sy = map(y / z, 0, 1, 0, height);
  
  float r = map(z, 0, width, 16, 0);
  circle (sx, sy, r);
}
}

Star[] stars = new Star[1000];

void setup() {
  size(500, 500); //set screen size
  background(0);
  for (int i = 0; i < stars.length; i++) {
    stars[i] = new Star();
  }
}

void draw() {
    background(0);
   
      translate(width, height/2);
      for (int i = 0; i < stars.length; i++) {
      stars[i].update();
      stars[i].show();   
 }
}```
````

---

<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: [September 9, 2021, 8:04am UTC](https://discourse.processing.org/t/not-using-classes-or-translate/32161/2 "2021-09-09T08:04:37Z")

</div>

Hi @UnsureNeedHelp,

Welcome to the forum! 😉

If this post is for a homework, please tag it so.

> [@UnsureNeedHelp](#):
>
> I really need help making this code work with these rules

When you post on a forum, it’s always necessary to explain what is your goal and what you are trying to do. In this case you have constraints but ultimately what is the desired output?

---

<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 9, 2021, 10:48am UTC](https://discourse.processing.org/t/not-using-classes-or-translate/32161/3 "2021-09-09T10:48:46Z")

</div>

Hello,

> [@UnsureNeedHelp](#):
>
> Not sure where to even start, any help would be heavily appreciated.

There are lots of resources here:

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

`:)`
