mirror of
https://github.com/nature-of-code/noc-book-2
synced 2024-09-29 05:36:56 +02:00
Merge pull request #905 from nature-of-code/notion-update-docs
fix examples
This commit is contained in:
commit
be4c84f06b
4 changed files with 2 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue