Hello
It’s super simple but I’m trying to write a code where I have a background image and when you click on it or run the mouse over it, squares appear and stay on the page. I know it’s most likely to do with the order of the code, but I can’t figure it out.
Here is my code so far, no shapes are appearing:
PImage img1;
void setup(){
size(800,600);
noLoop();
background(225);
smooth();
img1 = loadImage("Screenshot Sketch 7.png");
}
void draw(){
image(img1,0,0,800,600);
mousePressed();
rect(100, 100, mouseX, mouseY);
}
Thanks for any help!