Adding feedback after participant's response

URL of experiment:

Description of the problem: I’m trying to implement a brief visual feedback right after the participant gives a response. To do so I created the following code component, in the ‘each frame’ tab.

if (mouse.getPressed()[0] === 1) {
clickable = [hitbox1, hitbox2, hitbox3, hitbox4];
for (const obj of clickable) {
if (obj.contains(mouse) && response_given == false) {
response_given = true;

if (response_given === true) {
feedbacktimer += 1;
feedback.opacity = 1;
GResp_4.opacity = 0.5;
if (feedbacktimer >= 30) {
continueRoutine = false;

At the beginning of the routine, ‘feedbacktimer’ is assigned a value of 0, and ‘response_given’ is set to false. Given the code I showed you, I would expect to see my feedback stimuli for 30 frames and then continue to the next routine. However neither of these happen after a response.