https://editor.p5js.org/LunaChen/full/sZYEkZO0N
https://editor.p5js.org/LunaChen/full/ElUF-foL2
Using the float number between 0~1 to be the percentage of chance each state of moving.
step() {
let r = random(1);
//40% chance of moving to the right
if (r < 0.4) {
this.x++;
} else if (r < 0.6) {
this.x--;
} else if (r < 0.8) {
this.y++;
} else {
this.y--;
}
}
Not “Perlin noise”, but “value noise”
(OpenSimplexNoise, value noise, gradient noise, simple noise, worley noise…..)
noise() = = random()
Worley noise蜂窝
x+=random(-1,1);