Quote:Star stara;
Starchaos starb;
void setup() {
size(500, 500);
smooth();
///???????????????????????????????
//stara = new stara(1);
//starb = new starb(1);
//????????????????????????????????
// Did you mean this? :::::::::::::::::
stara = new Star(1);
starb = new Starchaos(1);
///:::::::::::::::::::::::::::::::
}
void draw() {
background(64);
fill(255);
rect(0, 0, width/2, height);
fill(255, 0, 0);
if (mouseX < 250) {
stara.display();
}
else {
starb.display();
}
}
//------------------
//-----------------
class Star {
float starsz;
Star(float starSize) {
starsz = starSize;
}
void display() {
scale(starsz);
int x = 0;
int limitX = 250;
int y = 0;
int limitY = 500;
noStroke();
fill(255, 0, 0);
while(y <= limitY) {
while(x <= limitX) {
//star
pushMatrix( );
// Added this::::::::::::::::::::::::::::::
int points = 5;
//:::::::::::::::::::::::
// points undefined??????????????????????????????????
for(int i=0; i < points; i++) {
rotate( TWO_PI / 5 );
triangle(-15/2, 0, 0, 100, 15/2, 0);
}
popMatrix( );
}
}
}
}
///????????????????????????????????
//} // This looks like one too many.
///????????????????????????????????
//-----
class Starchaos {
float starcsz;
Starchaos(float starchaosSize) {
starcsz = starchaosSize;
}
void display() {
scale(starcsz);
float[] x;
float[] y;
x = new float[100];
y = new float[100];
for (int i=0; i < x.length; i++) {
x[i] = random(width);
y[i] = random(height);
}
background(0);
fill(255, 0, 0);
noStroke();
ellipse(width/2, height/2, 200, 200);
fill(255);
for (int i=0; i < x.length; i++) {
ellipse(x[i], random(height), 50, 50);
// triangle(x[i], random(height), x[i], random(height), random(width), y[i]);
}
}
}
Ctrl-t formats messy code. It may complain at you if you have too many { or }'s. Maybe. The best thing to do is to indent properly! "points was not defined, and you were also trying to use a variable name as a type.