xxxxxxxxxx
28
class Particle {
constructor(position) {
this.acceleration = createVector(0, 0);
this.velocity = p5.Vector.random2D();
this.position = position.copy();
this.brain = _________;
}
applyForce(force) {
let f = force.copy();
f.div(this.mass);
this.acceleration.add(f);
}
update() {
this.velocity.add(this.acceleration);
this.position.add(this.velocity);
this.acceleration.mult(0);
}
show() {
stroke(255);
strokeWeight(2);
fill(255, 100);
ellipse(this.position.x, this.position.y, 16);
}
}