Wednesday, 5 November 2014

Lab 5 1 Balloon

class Balloon{
  float x;
  float y;
  float r;

Balloon(int x, int y, int r){

  this.x = x;
  this.y = y;
  this.r = r;

}
void display(){

  line(this.x , this.y, this.x, this.y+this.r);
  ellipse(this.x, this.y, this.r, this.r);

}
void move_up(){
 this.y = this.y-3;
 if(this.y < 0){this.y = height;}
}
void move_right(){
 this.x = this.x+1.5;
 if(this.x > width){this.x = 0;}
}
void fill_c(){
 fill(this.x+this.y-445);
}
}


Balloon b;
void setup(){
  size(500, 500);
  b = new Balloon(250, 250, 50);
}

void draw(){
  background(255);
  b.fill_c();
  b.display();
  b.move_up();
  b.move_right();
}

No comments:

Post a Comment