Mouse/key pressed question

please format code with </> button * homework policy * asking questions

Hi!!
I need some help with a project. I need to put in images and when I push for example number 1 a certain image pops up and when I push number 2 another image shows up. I just don’t know how to do it.

in the keyPressed() function set a variable showWhichImage
to 1 or 2, depending on your input

And then:

before setup()

int showWhichImage=1;

in draw() :

if(showWhichImage==1)
    image(a1,....
else if (showWhichImage==1)
    image(b1,....

Hey, and welcome to the forum!

Great to have you here!

Warm regards,

Chrisir