Can someone help me troubleshoot a basic code?
in
Programming Questions
•
5 months ago
Long story short, I had this code working a couple weeks ago. I finally found it again and it appears to be broken (not sure if someone found it and messed with it or what). Bottom line, I keep getting the same error (int, int) is undefined.
Below is the code for the first part (the one with the error)
int maxCircles = 10;
Circle[] circles = new Circle[maxCircles];
void setup(){
size(400,400);
background(0,0,0);
frameRate(120);
}
void draw(){
for(int i=0; i<maxCircles; i++){
circles[i] = new Circle(int(random(width)), int(random (height)));
}
fill(0,0,0,30);
rect(0,0,width,height);
}
Below is the next part (the class called Circle)
class Circle{
//Constructor
Circle(int x, int y, int size){
fill(random(255),random(255),random(255),random(255));
ellipse(x,y,size,size);
}
}
Can anyone help me fix this please?
Thank you!
~Kizuna
1