# Object Methods not looping

**URL:** <https://discourse.processing.org/t/object-methods-not-looping/10995>\
**Category:** Beginners\
**Created:** [May 7, 2019, 10:00am UTC](https://discourse.processing.org/t/object-methods-not-looping/10995 "2019-05-07T10:00:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timo1](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@Timo1](https://discourse.processing.org/u/Timo1)\
**Post date:** [May 7, 2019, 10:00am UTC](https://discourse.processing.org/t/object-methods-not-looping/10995/1 "2019-05-07T10:00:33Z")

</div>

Hi there,

Not sure if this a bug or if I have done something silly, but I have a very simple sketch using a class which for some reason is not updating/looping…

```auto
Circle ball;

void setup() {
  size (100,100); 
  background(255);
  ball = new Circle();
  
}

void draw() {
      pushMatrix();
      translate (width/2,height/2);
        ball = new Circle();
        ball.display();
      popMatrix();
      
}

class Circle { //<----------- Class
float d =10;
float grow = 1;

//constructor
Circle(){  
}
    
void display() {
  fill(255,0,0);
  ellipse(0,0,d,d);
    
  d= d + grow;
  if (d < 0 || d > 60) {
  grow = grow * -1;
  }
 }
}

```

---

<div class="post-metadata">

**Author:** ![hotfooted](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hotfooted/32/3670_2.png) [@hotfooted](https://discourse.processing.org/u/hotfooted)\
**Post date:** [May 7, 2019, 10:35am UTC](https://discourse.processing.org/t/object-methods-not-looping/10995/2 "2019-05-07T10:35:54Z")

</div>

you only need to instantiate the ball in the setup atm you are re instantiating the ball every draw so change this

```auto
void draw() {
  pushMatrix();
  translate (width/2, height/2);
  ball = new Circle();
  ball.display();
  popMatrix();
}

```

to

```auto
void draw() {
  background(0);
  pushMatrix();
  translate (width/2, height/2);
  ball.display();
  popMatrix();
}

```

and you should be right.
