Merge pull request #905 from nature-of-code/notion-update-docs

fix examples
This commit is contained in:
Daniel Shiffman 2024-03-06 21:41:40 -05:00 committed by GitHub
commit be4c84f06b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 4 deletions

View file

@ -14,7 +14,7 @@ function setup() {
createCanvas(640, 240);
flock = new Flock();
// Add an initial set of boids into the system
for (let i = 0; i < 1000; i++) {
for (let i = 0; i < 120; i++) {
let boid = new Boid(width / 2, height / 2);
flock.addBoid(boid);
}

View file

@ -31,7 +31,7 @@ function setup() {
grid = make2DArray(cols, rows);
flock = new Flock();
// Add an initial set of boids into the system
for (let i = 0; i < 1200; i++) {
for (let i = 0; i < 800; i++) {
let boid = new Boid(random(width), random(height));
flock.addBoid(boid);
}

View file

@ -32,7 +32,6 @@ function draw() {
target = new Target(random(width), random(height));
pursuer.pos.set(width / 2, height / 2);
}
//noLoop();
pursuer.update();
pursuer.show();

View file

@ -37,7 +37,6 @@ class Vehicle {
// Scale to maximum speed
desired.setMag(this.maxspeed);
desired.mult(-1);
// Steering = Desired minus velocity
let steer = p5.Vector.sub(desired, this.velocity);