Hi together,
I want to do the BART task (pumping up a balloon with pressing space til it bursts) on Pavlovia but have an issue with the space button being pressed. I want to pump up the balloon and therefore need seperated space presses to pump it up. When I run it locally on PsychoPy, that works. But it seems that with the Java Script I have, it does not stop when space is pressed but you can just leave down the finger and it pumps up the baloon till it pops. Now this biases my results and the whole idea of the game… this is the following java script i use for this:
var thisResp = psychoJS.eventManager.getKeys();
var spacePressed = thisResp.includes(“space”);
// Debugging output
console.log(thisResp: ${thisResp});
console.log(spacePressed: ${spacePressed}, prevSpacePressed: ${prevSpacePressed});
if (spacePressed && !prevSpacePressed) { // Detect space press only if it was not pressed before
nPumps += 1;
console.log(nPumps: ${nPumps}, maxPumps: ${maxPumps}); // Debugging output
if (nPumps > maxPumps) {
popped = true;
continueRoutine = false;
}
}
if (thisResp.includes(“return”)) {
popped = false;
continueRoutine = false;
}
prevSpacePressed = spacePressed; // Update the previous space pressed state
any ideas what could be wrong? Thank you!!