class Attracter extends Thingy { public float strength; public boolean activated; public float angle; public float angular_speed; public boolean clockwise; public float distance; private PVector center; Attracter(float initial_strength) { super(); this.center = new PVector(random(width),random(height)); this.strength = initial_strength; this.activated = false; this.angular_speed = random(PI/720, PI/3); this.clockwise = (random(0,1) > 0.5); this.angle = random(0,2 * PI); this.distance = random(20, width/2); this.loc = new PVector(center.x + distance * cos(angle), center.y + distance * sin(angle)); } void update() { //PVector offset = PVector.sub(new PVector(width/2,height/2), this.loc); //float distance = offset.mag(); angle = angle + (this.clockwise ? -1 : 1) * angular_speed; this.loc.x = center.x + distance * cos(angle); this.loc.y = center.y + distance * sin(angle); } void display() { noStroke(); fill(255,0,0,80); ellipseMode(CENTER); ellipse(this.loc.x,this.loc.y,1,1); stroke(50); noFill(); //line(this.loc.x,this.loc.y,width/2,height/2); } }