unexpected token: ( on a line with clearly no parentheses/matched parenthesis
in
Programming Questions
•
2 years ago
Really annoyed about this. At the beginning of the LineMaker class, an error comes up that says "unexpected token: (". Is it my code, or is it Processing?
- Circle[] circles = new Circle[10];
- LineMaker ndraw;
- void setup() {
- size(500, 500);
- background(200);
- ndraw = new LineMaker(color(255,100));
- for(int i = 0; i < circles.length; i++) {
- circles[i] = new Circle(random(width), random(height), 50, color(0));
- circles[i].display();
- }
- }
- void draw() {
- background(255);
- for(int i = 0; i < circles.length; i++) {
- for(int j = 0; j < circles.length; j++) {
- if(dist(circles[i].x,circles[i].y,circles[j].x,circles[j].y) < 200) {
- ndraw.connect(circles[i],circles[j]);
- }
- }
- circles[i].x++;
- circles[i].display();
- }
- }
- class LineMaker() { // <----- error happens on this line
- color nodeColor;
- LineMaker(color fill_) {
- fill = fill_;
- }
- void connect(Circle c1, Circle c2;) {
- stroke(nodeColor);
- line(c1.x, c1.y, c2.x, c2.y);
- }
- }
- class Circle {
- int x = width / 2;
- int y = height / 2;
- int fill = color(0,0,255,100);
- float size = 20;
- Circle(int x_, int y_, int size_, color fill_) {
- x = x_;
- y = y_;
- size = size_;
- fill = fill_;
- }
- Circle(float x_, float y_, float size_, color fill_) {
- x = (int) x_;
- y = (int) y_;
- size = size_;
- fill = fill_;
- }
- void display() {
- fill(fill);
- ellipse(x, y, size, size);
- }
- }
1