Create response of swiping left, right, up and down
Hello!
I wanted to create an experiment where a word is shown on the centre of the screen and can be swiped right, left, up and down by the participant on a touch screen device. I have stored the words in the loop and used inline script to display the words on the screen using canvas. However, I need help about the the swiping response can be created in OpenSesame. Thanks!
Comments
Hi Radhika,
How far did you get already? How do you want the swiping to look? I think the most straightforward solution is to make the position of the stimulus dependent on the currently touched position. The basic approach could look like this:
ms = Mouse() cv= Canvas() cv['word'] = Text('someWord') cv.show() while True: b1,b2,b3 = ms.get_pressed() # if touch happened (and is being happening), get the current position and adjust the stimulus pos while b1: (x,y), time = ms.get_pos() cv['word'].x = x cv['word'].y = y cv.show() # if stimulus was moved, stop trial if cv['word'].x != 0: breakHope this helps. Let me know if you need more help.
Eduard