# Is there big differences between Repl.it and the Processing IDE?

**URL:** <https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [February 19, 2021, 8:42pm UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943 "2021-02-19T20:42:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spamelim](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@spamelim](https://discourse.processing.org/u/spamelim)\
**Post date:** [February 19, 2021, 8:42pm UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/1 "2021-02-19T20:42:38Z")

</div>

For class, I use the website repl.it and code fully in processing on it. It’s not meant to use processing but my professor uses some sort of plugin that makes it work. Anyways, for any complex projects, usually, one with multiple classes, code that works perfectly on repl.it will either not work at all or the output will be completely bugged. An example is a ball project I am doing with 100 balls called in using an array that all move. On repl.it, it works. On the IDE, all the balls are stuck in the top left corner using the exact same code. I can reply to anyone with the code but it is over 100 lines.

---

<div class="post-metadata">

**Author:** ![spamelim](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@spamelim](https://discourse.processing.org/u/spamelim)\
**Post date:** [February 19, 2021, 8:53pm UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/2 "2021-02-19T20:53:26Z")

</div>

The code:

```auto
class ball
{ 
  float x;
  float y;
  float r1 = random(0,255);
  float b1 = random(0,255);
  float g1 = random(0,255);
  float d = random(10,30);
  float xSpeed = random(-4,4);
  float ySpeed = random(-4,4);

  ball(float x,float y)
  {
    
  }
  void render()
  {
    fill(r1,g1,b1);
    ellipse(x,y,d,d);
  }
  void move()
  {
    x = x + xSpeed;
    y = y + ySpeed;
  }
  void bounce()
  {
    if(x > width - d/2)
    {
      xSpeed = -xSpeed;
    }

    if(x < 0 + d/2)
    {
      xSpeed = -xSpeed;
    }

    if(y > height - d/2)
    {
      ySpeed = -ySpeed;
    }

    if(y < 0 + d/2)
    {
      ySpeed = -ySpeed;
    }
  }
}

ball[] balls = new ball[100];
float x;
float y;
void setup()
{
  size(600, 400);
  x = random(0,width);
  y = random(0,height);
  for(int i=0; i < 100; i++)
  {
    balls[i] = new ball(x,y);
  }
}

void draw()
{
  background(50);
  for(int i = 0; i < 100; i++)
  {
    balls[i].render();
    balls[i].move();
    balls[i].bounce();
    
  }
}

```

---

<div class="post-metadata">

**Author:** ![Pr0tonX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pr0tonx/32/2590_2.png) [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)\
**Post date:** [February 19, 2021, 9:56pm UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/3 "2021-02-19T21:56:53Z")

</div>

Hey,

you’re passing to your `ball` constructor x and y values, but you don’t use them to set the value of ball.x and ball.y, so you just have to do it, and it will works perfectly :

```auto
// inside your ball class
ball(float _x,float _y)
  {
    x = _x;
    y = _y;
  }

```

I don’t know why it works without it on repl.it, but it should not actually 🙂

---

<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:** [February 19, 2021, 10:01pm UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/4 "2021-02-19T22:01:41Z")

</div>

> [@spamelim](#):
>
> ```auto
> ball[] balls = new ball[100];
> 
> ```

Also you should be using an uppercase name for a class because the in the line above, can you really tell where’s the class?

It’s more readable like this 😉 :

```auto
class Ball {
}

Ball[] balls = new Ball[100];

```

See : [Code Conventions for the Java Programming Language: 9. Naming Conventions](https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html#15411)

Naming conventions can be annoying when you start programming but it’s really worth it !!

---

<div class="post-metadata">

**Author:** ![mcintyre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mcintyre/32/14561_2.png) [@mcintyre](https://discourse.processing.org/u/mcintyre)\
**Post date:** [February 20, 2021, 2:14am UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/5 "2021-02-20T02:14:54Z")

</div>

@spamelim Do you happen to know if your professor has your class using Processing or Processing.js on repl.it? Do your projects come with an index.html file?

---

<div class="post-metadata">

**Author:** ![spamelim](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@spamelim](https://discourse.processing.org/u/spamelim)\
**Post date:** [February 20, 2021, 2:16am UTC](https://discourse.processing.org/t/is-there-big-differences-between-repl-it-and-the-processing-ide/27943/6 "2021-02-20T02:16:55Z")

</div>

I think processing.js. They come with a main.java and index.html, to add a new file for a class I have to edit the HTML as well so it will work.
