Stimuli from previous trial remain on the screen for subsequent trials

URL of experiment: Pavlovia

Description of the problem:
My experiment requires participants to drag and drop a stimulus, and for this stimulus to reset to position = (0,0) for the next trial.
I used a code components to do this (my experiment is named builderonly because I wanted to add my code components one at a time so I can debug where the issues are so it started life as builder only)

This works fine in Psychopy locally however in JS online the stimulus from the previous trial remains on screen in the position it was dragged to.

I tried setting the opacity = 0 in End routine so it would fade into the background but in Psychopy this did not take effect until the start of the next trial (no change in JS).
I also tried resetting the position back to 0,0 at end routine and this also did not take effect until the start of the next trial in Psychopy (no change JS).
I think the the challenge in coding this is making sure that the code can decipher the stimulus in the previous trial from the stimulus in the current trial and I’m not sure how to do this.

My other idea was to refresh the screen however I know that the crib sheet does not advise the use of win.flip().

Code components:

hi @Lucy, would it be possible to give me developer access to your project repository so that I can investigate some more? Or is https://gitlab.pavlovia.org/Lucy23/spatial_localisation pretty much the same? Thanks, s.

Hi @sotiri, I think I have invited you to have developer access and yes that is the link :slight_smile:

Hi @Lucy, OK great, on it, thanks :blush:

1 Like

I’ve had help on this issue based on a question I asked in another thread.
The reason the stimuli remained on screen into the next trial was because I misunderstood the drag and drop process.

At its most basic you do not need the createPiece function from the demo (because you don’t need any more pieces and that is what was being drawn onto the screen in my case and persisting into the next trial).

The lines of code needed for drag and drop can be found in the following thread:

1 Like

Ah cool, yes that makes sense, glad to hear you were able to find a solution and many thanks @Lucy for taking the time to follow up with the details :+1:

1 Like