psychopy.org | Reference | Downloads | Github

Prevent Hold Mouse Clicks

So I gathered this code that I incorporated into (thank you dvbridges!):

if (mouse.getPressed()[0] === 1) { // If left mouse button pressed

clickable = [image_01, image_02, image_03, image_04, image_05, image_06, image_07, image_08, image_09]; // clickable stim

for (const obj of clickable) { // for each clickable stim, check if it contains the mouse

if (obj.contains(mouse)) {

  mouse_clicked[clickable.indexOf(obj)] = 1;

  image_transparency[clickable.indexOf(obj)] = 0.5;

}

}

}

However, I am having the issue that if you hold down mouse 1 you select ever stimulus image. Would there be an easy way to stop this with the code I already have?