I am trying to get multiple stimuli to move around the screen with the same constant phase speed. For some reason when I try to get all of my stimuli to phase at the same rate it always seems that one is going slow, the next a but faster, another a bit faster, and the final fourth one even faster. Any ideas on how to resolve the issues or point out any mistakes? Thanks!
This is written in the “Each Frame” tab of a custom code in the builder GUI:
print("timer = " + str(timer.getTime()))
if(timer.getTime() > 0):
for stim in stimsArr:
stim.phase = (100.0,100.0)
print(stimsArr[i].phase)
for i in range(len(stimsArr)):
if(posToPix(stimsArr[i])[0] >=xright or posToPix(stimsArr[i])[0] <= xleft):
dxdy[i][0] *= -1
if(posToPix(stimsArr[i])[1] <=ytop or posToPix(stimsArr[i])[1] >= ybot):
dxdy[i][1] *= -1
if i == 0:
print("dx: " + str(dx) + " dy: " + str(dy))
print(posToPix(stimsArr[i]))
stimsArr[i].pos += (dxdy[i][0],dxdy[i][1])
win.flip()