the bracket error was due to transfering over here. careless mistake.
- class cellFast{
- final PVector location = new PVector(random(width), random(height));
- final PVector velocity = new PVector();
- final PVector acceleration = new PVector();
- final static float TOP_SPEED = 7;
- final static short DIAM = 20;
- final static short DIM = 5, MIN_DIST = 60, MAX_SPD = 6;
- void update1() {
- PVector.random2D(acceleration).mult(noise(7));
- velocity.add(acceleration);
- velocity.limit(TOP_SPEED);
- location.add(velocity);
- }
- void displayFast() {
- stroke(0);
- strokeWeight(2);
- fill(0200);
- ellipse(location.x, location.y, DIAM, DIAM);
- }
- void checkEdges1() {
- if (location.x > width) location.x = 0;
- else if (location.x < 0) location.x = width;
- if (location.y > height) location.y = 0;
- else if (location.y < 0) location.y = height;
- }
- boolean isNear(cellFast other) {
- //return dist(x, y, other.x, other.y) < MIN_DIST;
- //return sq(abs(other.x - x)) + sq(abs(other.y - y)) < MIN_DIST*MIN_DIST;
- return abs(other.location.x - location.x) < MIN_DIST
- && abs(other.location.y - location.y) < MIN_DIST;
- }
- void drawLine(cellFast other) {
- stroke(4);
- line(location.x, location.y, other.location.x, other.location.y);
- location.x += 3; //move opposite direction to not intersect
- location.y += random(5);
- }
- }