We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I'm trying to create an interactive page using p5js where you click on various images to change between them. The page starts out with 5 different images I have put in various places, and for each of those 5 images I have 3-4 alternative images to change between upon click. I have all of the different images loaded as different variables, and have tested all of the alternative images to make sure their varying sizes fit nicely in the same (x,y) placement of the original images. I am now stuck trying to make the interactivity happen- I tried starting out changing one of the images using the mousePressed() function, which worked for switching between just 2 images, but I want to randomize between the 3+ images upon click. I then tried making arrays for each of the 5 original images, and in those arrays were the options for the other images. I think this might work with the mousePressed() function as well, but I am having trouble with the syntax of randomizing images in an array upon click... also having trouble with the placement of the mouse for the click because these are not square images. Is there a way I can just have the conditional statement apply to clicking on the image itself rather than the x & y ranges? Also, I might be completely off with everything, should I even use arrays? If anyone has suggestions I would very much appreciate it because this seems like a big undertaking and I only just learned p5js about a month ago!