I'm developing an experiment in which the subject has to learn to shuttle from one side to the other of a grid every two seconds in order to avoid a punishment (that is represented in my experiment by a brief sound that I named 'shock').
So far, I was able to develop the grid and the programming for the virtual subject, represented by a red circle, to move around. I'm having a hard time to combine this with the 'shock' every two seconds, or the restart of the 2-sec interval if 'subject' shuttle from one side of the grid to the other.
I tried to create a tag named 'last side touched touched' (right or left) and if it is set to right 'shock timer' (a parameter I created) resets. Another trial ('Shock') is set to be presented if 'shock timer' is > 1999ms.
I was hoping that this configuration would reset 'shock timer' every shuttle the subject did and, therefore, 'Shock' would never be presented if a shuttle was emitted every 2 seconds or less.
However, I can shuttle and move around the grid just fine, but all the rest is not working...
Would it be possible to give me a hand, please?
I'm attaching the files and the experiment here to make it easier to understand. Also attaching a paper with a similar methodology.