Classes and Parantheses.
in
Programming Questions
•
7 months ago
Hi,
Very beginner issue with classes (?). I keep getting the "Found one too many { without a } to match it", but I have the correct matching parentheses...do I not? Is it an issue with defining classes properly.....? I can make a single example of the StarFire work as I wish, so I am trying to instantiate a grid of 30 x 30 objects. I also expect RAM issues, so have dropped the frame rate to 12.
Any help, or constructive derision most appreciated!
StarFire sf = new StarFire (15, 15);
void setup(){
size (930, 930);
background(10);
smooth();
stroke (255, 30);
frameRate(12);
}
void draw(){
background(10);
for (int x = 15; x < 930; x += 30){
int xp = x;
for (int y = 15; x < 930; x += 30){
int yp = y;
PVector v1 = new PVector(xp, yp, 0);
PVector v2 = new PVector(mouseX, mouseY, 0);
float hm = 1000 - (PVector.dist(v1, v2));
float h = map(hm, 0, 1000, 20, 255);
update.sf (xp, yp);
}
}
}
class Starfire {
for (int i = 0; i < h; i++){
float hs = (h/2) * random(0.0, 1.0); //random line length generator
float an = random(-1.0, 1.0); //random angle generator
float sw = random(1, h/50); //strokeweight generator
float ofx = random(-5.0, 5.0); //offset x origin for visual interest
float ofy = random(-5.0, 5.0); //offset y origin for visual interest
rotate(PI/an);
strokeWeight(sw);
line(0 + ofx, 0 + ofy, 0, hs);
}
}
Very beginner issue with classes (?). I keep getting the "Found one too many { without a } to match it", but I have the correct matching parentheses...do I not? Is it an issue with defining classes properly.....? I can make a single example of the StarFire work as I wish, so I am trying to instantiate a grid of 30 x 30 objects. I also expect RAM issues, so have dropped the frame rate to 12.
Any help, or constructive derision most appreciated!
StarFire sf = new StarFire (15, 15);
void setup(){
size (930, 930);
background(10);
smooth();
stroke (255, 30);
frameRate(12);
}
void draw(){
background(10);
for (int x = 15; x < 930; x += 30){
int xp = x;
for (int y = 15; x < 930; x += 30){
int yp = y;
PVector v1 = new PVector(xp, yp, 0);
PVector v2 = new PVector(mouseX, mouseY, 0);
float hm = 1000 - (PVector.dist(v1, v2));
float h = map(hm, 0, 1000, 20, 255);
update.sf (xp, yp);
}
}
}
class Starfire {
for (int i = 0; i < h; i++){
float hs = (h/2) * random(0.0, 1.0); //random line length generator
float an = random(-1.0, 1.0); //random angle generator
float sw = random(1, h/50); //strokeweight generator
float ofx = random(-5.0, 5.0); //offset x origin for visual interest
float ofy = random(-5.0, 5.0); //offset y origin for visual interest
rotate(PI/an);
strokeWeight(sw);
line(0 + ofx, 0 + ofy, 0, hs);
}
}
1