xxxxxxxxxx
37
class Walker {
constructor(x, y){
this.pos = createVector(x, y);
this.vel = createVector(2, 0);
this.acc = createVector(1, 0);
}
update() {
xoff = xoff + 0.001;
angleMode(DEGREES);
// noiseSeed(2);
this.vel.setHeading(noise(xoff) * 360);
// noiseSeed(1);
// this.acc.setHeading(noise(xoff) * 360);
// this.vel.add(this.acc);
this.vel.limit(4);
this.pos.add(this.vel);
if(this.pos.x > width){
this.pos.x = 0;
}
if(this.pos.y > height){
this.pos.y = 0;
}
if(this.pos.x < 0){
this.pos.x = width;
}
if(this.pos.y < 0){
this.pos.y = height;
}
}
show() {
stroke(255);
strokeWeight(3);
point(this.pos.x, this.pos.y);
}
}