Help! - Why it dont find my images ??

I created an array, and I am trying to load all my images using a for loop.
My images are named in order for that, but when I reload the page to see my sketch, the console show a message saying that the path of my images could not be found. Here is an image of my images, and the path
https://i.imgur.com/aVlqKfu.png
Here is the message of the console https://i.imgur.com/4woK730.png

And here is my code. Can anyone tell me what is wrong, Ive been thinking for a while and I cant figure it out.. Thanks

let campeones = [];
let imgCampeones = [];

function preload() {
    for(var i = 0; i < 6; i++){
        imgCampeones[i]= loadImage(`C:/Users/DDV2 NVE/Desktop/CC/campeon${i}.jpg`);
    }
}

function setup() {
    createCanvas(700, 600);
    for(var i = 0; i < 10; i++){
        let x = random(width);
        let y = random(height);
        let campeon = random(imgCampeones);
        campeones[i] = new Campeones(x, y, 50, campeon);
    }
}

function draw() {
    background(200);

    for(let champ of campeones){
        champ.drawCampeon();
        champ.move();
    }

}

class Campeones {
    constructor(x, y , r, campeon){
        this.x = x;
        this.y = y;
        this.r = r;
        this.campeon = campeon;
    }

    drawCampeon(){
        image(this.campeon, this.x, this.y, this.r, this.r);
    }


    move(){
        this.x += random(-5, 5);
        this.y += random(-5, 5);
    }

    Clicked(px, py){
        if(px > this.x && px < this.x + this.r && py > this.y && py < this.y + this.r){
            return true
        }
    }


    intersection(enemy){
        let d = dist(this.x, this.y, enemy.x, enemy.y);
            return (d < this.r + enemy.r)
    }
}

Answers

Sign In or Register to comment.