update
This commit is contained in:
parent
4f9153ba8e
commit
528227586a
20
vehicle.js
20
vehicle.js
@ -12,8 +12,8 @@ function setup() {
|
||||
function draw() {
|
||||
// 追逐鼠标();
|
||||
// 逃避鼠标();
|
||||
巡游小车();
|
||||
// 小车追逐();
|
||||
巡游小车();
|
||||
}
|
||||
|
||||
function 追逐鼠标() {
|
||||
@ -34,15 +34,6 @@ function 逃避鼠标() {
|
||||
vehicle1.show();
|
||||
}
|
||||
|
||||
function 巡游小车() {
|
||||
background(64);
|
||||
vehicle1.wander();
|
||||
vehicle1.move();
|
||||
vehicle1.turn();
|
||||
vehicle1.drawPath();
|
||||
vehicle1.show();
|
||||
}
|
||||
|
||||
function 小车追逐() {
|
||||
background(64);
|
||||
vehicle1.seek(vehicle2, 20);
|
||||
@ -55,6 +46,15 @@ function 小车追逐() {
|
||||
vehicle1.show();
|
||||
}
|
||||
|
||||
function 巡游小车() {
|
||||
background(64);
|
||||
vehicle1.wander();
|
||||
vehicle1.move();
|
||||
vehicle1.turn();
|
||||
vehicle1.drawPath();
|
||||
vehicle1.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回可指定大小的随机二维向量
|
||||
* @param {number} magnitude 向量大小
|
||||
|
Loading…
Reference in New Issue
Block a user