My image does not load on the screen, I check the console but I have no errors, my image is prompted and live according to the console, I don't know if this problem is because my program has the P5.Play library or because the drawSprites() command, I use scenes in my program and always put the command image() in front of the background
Half of my code is below
var player
var target
var scene = 1
let img
function preload() {
img = loadImage('assets/Pixel Studio/ButtonUnpressed.gif')
}
function setup(){
createCanvas(960, 430)
cursor('none')
target = createSprite(850, 100)
targetImg = loadImage('assets/128/dagger.png')
target.addImage(targetImg)
player = createSprite(150, 150)
playerImg = loadImage('assets/128/dagger.png')
player.addImage(playerImg)
}
function draw(){
if (scene === 1) {
background(230)
image(img, 200, 200)
I am using the P5.play library, if you have experience in this library, please talk to me.
I put img() in the Setup (but nothing happened), kept only one scene (no modification too), so I tried calling my image only, no sprites, element or other objects (but it dont has displayed), I think of my problem is about the program don’t search for my img variable from the preLoad() function, am I correct? It’s really a mess because when I called preLoad() for the first time, my image was displayed and it worked correctly.
I guess you are confunded about my post “In front of the background”, sorry me😀.
But you got it help me too, i readed your reference (reference | p5.js) and i got it another ways to display my image(how sprite), thanks by your help too😁