Stops moving when two stimuli meets

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win 10

What are you trying to achieve?:
I’m trying to make two stimuli move according to the key I give. Specifically, they will approach to each other. What I want is both of them to stop when those two stimuli meets. However, currently person2 keeps going right until the end, and image2(in the green condition) also keeps going left until the end.

This is what I have inserted in the code component

This is how they move cross each other(sorry I can’t insert mov file here)

  • Please post actual formatted code as per Please surround python code with backticks rather than screenshots. It makes it much harder to suggest changes.
  • You really need to avoid absolute paths and shift to using relative ones.
  • Regardless, don’t use Windows-style \ separators, they can have special meaning in Python strings. Use / instead.

Your stimuli are doing exactly what your code tells them to do (keep moving in response to keypresses). If you want them to stop at some point, you need to include the constraints in the code. e.g. don’t increment the x coordinate if it exceeds some boundary value.

Alternatively, you might be able to use the .contains() method of your stimuli to detect collisions: http://www.psychopy.org/api/visual/imagestim.html#psychopy.visual.ImageStim.contains