Moving to next trial when joystick hovers over image stimuli

OS** (e.g. Win10): win 10,
PsychoPy version** (e.g. 1.84.x): 3
What are you trying to achieve?: Moving on to next trial when joystick hovers over an image without a button click.

My task involves moving a ‘cursor’ (.png) with a joystick to 5 different targets on the screen. Each trial requires movement to a different target. Once the ‘cursor’ reaches the target the task moves on to the next trial. I have created the 5 static images and a ‘cursor image’ which can be moved with the joystick. The target order the subject moves the cursor to is controlled by a 6th image that alternates between the position of the 5 static images but is a different colour. This makes it look like the static images a changing colour. See below.

What is not working:
I have entered the code below to stop the routine and move to next trial when the static image1 contains the joystick but I get the error below.

Thank you for your help in advanced.

Dave

Probably an easy solution:

Joystick.getX()
Joystick.getY()

Are missing the brackets in your code (resulting in the ‘int’ and ‘function’ error, because: .getX is returning the function not the value).

Thank you Luke, that has worked perfectly. I am also hoping to collect continuous positional data for the joystick. When I select ‘end routine on press’ - never and ‘save joystick state’ - every frame. I get the following error.

As before any help is appreciated.

Dave