Problem with stimuli rotating counterclockwise

Hi there. I’m trying to randomly rotate stimuli clockwise and counterclockwise in a Builder experiment. This is what I have in my code component:

**Begin Experiment
imPositions = [(-.35, 0), (.35, 0)]
shuffle(imPositions)  # to randomize first position
Image1P.setPos(imPositions[0])
Image2P.setPos(imPositions[1])

imDirection  = [1,-1] # to randomize rotation direction

**Begin Routine
Image1P.setPos(imPositions[0])
Image2P.setPos(imPositions[1])
shuffle(imPositions)  # to randomize position

shuffle(imDirection)
currentOri = 0

**Each Frame
if Image1P.ori < 180:
    Image1P.ori += 1
    currentOri = Image1P.ori
    
if abs(currentOri)  < 180:
   Image1P.ori += imDirection[0]
   
print('direction',imDirection[0])
print('orientation',Image1P.ori)

capture_directionerror

I get this but when I run the experiment, the stim only rotate clockwise. Either there is something missing in the code and I’m just not seeing it, or there’s a bug? Any help is appreciated!

The issue is that you have your old code in addition to my suggestion.

try replacing both of the above with

if abs(Image1P.ori) < 180:
    Image1P.ori += imDirection[0]

Hi Wakecarter! Happy new year!

Thanks for your response and apologies for the delay. I was out of commission the last month due to the end of term + illness. I tried the code you provided. Now none of the stimuli are rotating. :frowning:

What do the print statements say?