hey guys. I am still on the beginner’s page and trying to figure out the OOP and the error hint keep telling me “error on void” and I have no idea where did I go wrong.
Bubble b1;
Bubble b2
void setup() {
size(600, 600);
b1=new Bubble(10);
b2=new Bubble(30);
}
void draw() {
background(100, 20, 90);
b1.display();
b1.ascend();
b1.top();
}
//the class bubble section as below:
class Bubble {
float x;
float y;
float diameter;
Bubble(float tempD){
x=width/2;
y=height;
diameter=tempD;
}
void display() {
fill(20, 20, 90);
stroke(0);
ellipse(x, y, diameter, diameter);
}
void ascend() {
y--;
x=x+random(-2,4);
}
void top(){if(y<0){y=y+hieght;}}
}