/*
* @name Background Image
* @description This example presents the fastest way to load a
* background image. To load an image as the background,
* it must be the same width and height as the program.
*/
let bg;
function setup() {
// The background image must be the same size as the parameters
// into the createCanvas() method. In this program, the size of
// the image is 720x400 pixels.
bg = loadImage('assets/moonwalk.jpg');
createCanvas(720, 400);
}
function draw() {
background(bg);
}
or even better start with
function draw() {
// background(bg);
image(bg,0,0);
}
as you not show the link to your code and uploaded image
we can not test at https://editor.p5js.org/ ,
No, no the example worked on p5.js online. I’ve tried your code you gave me and adjusted it for my image and got the same error. I’ll try copying the example and adapt my code on it. I’ll get back to it later.
pls link to online editor,
pls post html and script file you use local
and a screen shot of the local path / file structure
also, what revision of p5.js you use local ( means when you install p5.js MODE / or update template )
I’m seeing the same errors when running my p5-powered game on github.io. It works fine on local web server, or on my own website. You can see it here, on any browser: https://zenzoa.github.io/bunbons/