mouseClicked function using an image

I have four emojis displaying in a canvas. Each image when clicked will change the background. For example, smiling face, a rising sun will appear. First question, how do I use the mouseClicked event on an image? Second, how do I trigger/call the created “class” (which contains the background) for each image after the mouse event? Is it a draw function under the mouse event?

Just loop over the container & check whether the mouse coordinates are inside each image area: :loop:

Here’s some online sketch w/ a grid of squares. They’re not images, but the principle is the same: :wink: