xxxxxxxxxx
30
// Seeking a Target (Seek)
// The Nature of Code
// The Coding Train / Daniel Shiffman
// https://youtu.be/p1Ws1ZhG36g
// https://thecodingtrain.com/learning/nature-of-code/5.2-seek.html
// Seek: https://editor.p5js.org/codingtrain/sketches/AxuChwlgb
// Seek with Sliders: https://editor.p5js.org/codingtrain/sketches/DROTtSI7J
// Arrive: https://editor.p5js.org/codingtrain/sketches/dQx9oOfTN
// Pursue: https://editor.p5js.org/codingtrain/sketches/XbsgoU_of
let vehicle;
let target;
function setup() {
createCanvas(400, 400);
vehicle = new Vehicle(100, 100);
}
function draw() {
background(0);
fill(255, 0, 0);
noStroke();
target = createVector(mouseX, mouseY);
circle(target.x, target.y, 32);
vehicle.seek(target);
vehicle.update();
vehicle.show();
}