This commit is contained in:
赵鑫 2022-12-11 03:27:17 +08:00
parent 2784cac35b
commit 4f9153ba8e

View File

@ -12,8 +12,8 @@ function setup() {
function draw() {
// 追逐鼠标();
// 逃避鼠标();
// 巡游小车();
小车追逐();
巡游小车();
// 小车追逐();
}
function 追逐鼠标() {
@ -119,9 +119,9 @@ class Vehicle {
const y = offset * sin(PI / 2 + this.heading);
target.add(x, y);
// noStroke();
// fill("#F063A4");
// circle(target.x, target.y, 5);
noStroke();
fill("#F063A4");
circle(target.x, target.y, 5);
const steering = target.sub(this.position);
this.acceleration.add(steering);
@ -179,7 +179,7 @@ class Vehicle {
noFill();
stroke(50);
strokeWeight(1);
if (this.path.length >= 1024) this.path.shift();
if (this.path.length >= 10240) this.path.shift();
beginShape();
this.path.forEach((v) => {
if (!v) {