# Why do i get assertion error on world.step();

**URL:** https://discourse.processing.org/t/why-do-i-get-assertion-error-on-world-step/4685
**Category:** Libraries
**Created:** [October 20, 2018, 2:02pm UTC](https://discourse.processing.org/t/why-do-i-get-assertion-error-on-world-step/4685 "2018-10-20T14:02:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![processing\_guy](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@processing\_guy](https://discourse.processing.org/u/processing_guy)
#### Post date: [October 20, 2018, 2:02pm UTC](https://discourse.processing.org/t/why-do-i-get-assertion-error-on-world-step/4685/1 "2018-10-20T14:02:29Z")

</div>

```auto
import fisica.*;

FWorld world;

FCircle player;
FBox pipeup;
FBox pipedown;

class game {

  float x = pipeup.getX();
  float y = pipeup.getY();
  float x1 = pipedown.getX();
  float y1 = pipedown.getY();

  void update() {
    x -= 4;
    x1 -= 4;
    y = pipeup.getY();
    y1 = pipedown.getY();
    pipeup.setPosition(x,y);
    pipedown.setPosition(x1,y1);
    if(x + 50 < 0){
      x = 600;
    }
    if(x1 + 50 < 0){
      x1 = 600;
    }
  }
}

game game;

void setup() {
  size(480, 600);
  smooth();

  Fisica.init(this);

  world = new FWorld();
  world.setGravity(0, 500);

  pipeup = new FBox(50, 200);
  pipeup.setPosition(400, 100);
  pipeup.setRotation(0);
  pipeup.setFillColor(#808080);
  pipeup.setNoStroke();
  pipeup.setGrabbable(false);
  pipeup.setStatic(true);
  world.add(pipeup);
  
  pipedown = new FBox(50, -200);
  pipedown.setPosition(400, 500);
  pipedown.setRotation(0);
  pipedown.setFillColor(#808080);
  pipeup.setNoStroke();
  pipeup.setGrabbable(false);
  pipeup.setStatic(true);
  world.add(pipedown);

  player = new FCircle(40);
  player.setPosition(width/3, 200);
  player.setRotation(0);
  player.setFillColor(#808080);
  player.setNoStroke();
  player.setGrabbable(false);
  world.add(player);
  
  game = new game();
}

void draw() {
  background(0);
  world.step();
  game.update();
  world.draw();
}

void mousePressed() {
  player.addImpulse(0, -666);
}

```

---

<div class="post-metadata">

### Author: ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)
#### Post date: [October 20, 2018, 3:34pm UTC](https://discourse.processing.org/t/why-do-i-get-assertion-error-on-world-step/4685/2 "2018-10-20T15:34:24Z")

</div>

Hello @processing_guy!

Your error is on this line:

```java
...
pipedown = new FBox(50, -200);
pipedown.setPosition(400, 500);
...

```

You should input non-negative numbers into length and width when defining a new instance of `FBox`, so it should be `FBox(50,200)`

Also noticed you have a mistake in setting attributes of pipedown but for pipeup as well

```java
...
  pipedown = new FBox(50, 200);
  pipedown.setPosition(400, 500);
  pipedown.setRotation(0);
  pipedown.setFillColor(#808080);
  pipeup.setNoStroke(); // <- right here
  pipeup.setGrabbable(false);
  pipeup.setStatic(true);
...

```

---

<div class="post-metadata">

### Author: ![processing\_guy](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@processing\_guy](https://discourse.processing.org/u/processing_guy)
#### Post date: [October 20, 2018, 3:58pm UTC](https://discourse.processing.org/t/why-do-i-get-assertion-error-on-world-step/4685/3 "2018-10-20T15:58:20Z")

</div>

thanks man you helped me a lot
