xxxxxxxxxx
32
let tinkerbell; // Define vehicleImage globally
function preload() {
// Load your image file
tinkerbell = loadImage('tinkerbell.png');
}
let targets = [];
function setup() {
createCanvas(windowWidth, windowHeight);
vehicle = new Vehicle(width / 2, height / 2);
}
// Create Target instances
for (let i = 0; i < 5; i++) {
targets.push(new Target(random(width), random(height)));
}
}
function draw() {
background(0);
// Update and display Target instances
for (let target of targets) {
target.update();
target.show();
}
// Other drawing and logic in your sketch
}