fabianmoronzirfas
11/12/2014 - 2:56 PM

simple_class.pde

Thing one;

void setup(){
one = new Thing(10,10);
frameRate(1);
}

void draw(){
background(255);
one.display();
one.x = int(random(0,width));
}

class Thing{
  int x = 0;
  int y  =0;
  
  Thing(int _x,int _y){
    this.x = _x;
    this.y = _y;
  
  }
  
  void display(){
    pushMatrix();
    translate(this.x, this.y);
    ellipse(0,0,10,10);
    popMatrix();
  }
}