Hello!
I am trying to implement the following: while participants listen to a piece of music, they need to tap the space bar following the rhythm. I would like to add an image that “walks” when participants tap the spacebar, otherwise it stays still.
I have added a code component at the beginning of the routine
x_pos = -0.45
step = 0.05
character_moving.pos = (x_pos, 0)
and at each frame:
keys = bar_character.getKeys(keyList=[‘space’], waitRelease=False)
if keys:
x_pos += step
x_pos = min(max(x_pos, -0.45), 0.45)
character_moving.pos = (x_pos, 0)
The problem is that my character does not proceed of one step at every key press, but I need to press multiple times before it moves ( as if the computer is not detecting the keypress, but I have checked multiple times and I do not get any error message). Changing the size of the steps does not help.
Do you have any ideas?
Thanks!