xxxxxxxxxx
35
class Walker {
constructor(){
this.x = width/2;
this.y = height/2;
}
display(){
stroke(0);
point(this.x, this.y);
}
step(){
let r = random(1);
print(r)
if (r < .5){
if (mouseX > this.x) {
this.x++
}else {
this.x--
}
if (mouseY > this.y) {
this.y++
}else {
this.y--
}
} else if (r < .75) {
this.x++;
this.y++
} else {
this.y--
this.x--
}
}
}