r/processing • u/Happy-Ad-8921 • Nov 16 '23
Syntax Error - Missing operator, semicolon, or ‘}’ near ‘setup’?
Hi, can someone help me find the solution to this error? Everything seems right to me and I can run the code in Openprocessing(even though the whole grid rotates a bit which is also weird). However, it doesn't work in processing.
Polygon [] polys;
int cols=10; rows=10;
void setup(){
size(800, 800, P3D);
smooth(8);
polys=new Polygon[cols*rows];
for(int i=0; i<polys.length;i++){
int col=i%cols;
int row=i/cols;
int sideCount=round(random(3,6));
float radius=random(20,40);
float x=map(col,0,cols-1,width*0.1,width*0.9);
float y=map(row,0,rows-1,height*0.1,height*0.9);
polys[i]=new Polygon(sideCount,radius,x,y);
}
}
void draw(){
for(int i=0; i<polys.length;i++){
polys[i].update();
}
background(255);
for(int i=0; i<polys.length;i++){
polys[i].display();
}
}
5
u/KaraPuppers Nov 16 '23
int cols=10; rows=10;
No variable type on rows. Probably meant a comma?
2
u/Happy-Ad-8921 Nov 16 '23
https://openprocessing.org/sketch/2092578
Here is the link to my code. Now it comes to the next question: Does anyone know why the rows of the grid are skewed?