Hi there,
I’ve been stuck on this issue for a while and can’t get anything that I’ve tried to work, so hopefully someone will be able to help! I’ve created a memory block in my task where participants are presented with a random 4 element sequence (targets change colour in a circle) which they must remember and then reproduce it on the following screen which is a blank template.
If the mouse is pressed in, or the polygons contain the mouse, then the colour of the target is changed to black and resets to white after .4 seconds - this all works perfectly. What I need is that after 4 targets have changed colour, for the routine to end and move onto the next one. However, I cannot get any sort of counter to work. Essentially, I need help creating a way to count the number of targets that have changed colour or had the mouse go over them, and after this occurs 4 times to skip the routine.
I have tried defining Count = 0
and count = []
in begin routine and adding to this in each frame following the target changing colour/mouse moving over the target with count = count +1
and count +=1
, as well as trying to use len - but I couldn’t get these to work.
My current code looks like this if it helps:
Begin Routine:
mem_pos=[twelve_4, five_4, ten_4, fifteen_4, twenty_4, twenty_five_4, thirty_4, thirty_five_4, fourty_4, fourty_five_4, fifty_4, fifty_five_4]
timer = core.Clock()
Each Frame:
for polygon in mem_pos:
if mem_production_mouse.isPressedIn(polygon) or polygon.contains(mem_production_mouse):
timer.reset()
polygon.color = 'black'
if timer.getTime() >=.4:
polygon.color = 'white'
Hopefully someone will be able to help! Do let me know if you need any more information.
Many thanks in advance!