xxxxxxxxxx
27
let robot;
let target;
let obstacles = [];
function setup() {
createCanvas(750, 750);
robot = new Robot(width / 2, height / 2);
target = new Target(width / 4, height / 4);
for (let i = 0; i < 10; i++) {
obstacles.push(new Obstacle(random(width), random(height)));
}
}
function draw() {
background(220);
for (let i = 0; i < obstacles.length; i++) {
// obstacles[i].move();
obstacles[i].display();
}
target.move(mouseX, mouseY);
target.display();
robot.follow(target, obstacles);
robot.display();
}