Drag and drop just one of multiple stimuli at a time

Am typing this on an iPad without a :snake: interpreter so this may be full of errors:

Begin routine tab:

stimuli = [square, square1, square2, …] # up to 9
current_square = -1

Each frame tab:

# create an array to record what stimulus numbers are 
# currently clicked in, defaulting to -1:
selected = np.zeros(9, dtype = int) - 1

# cycle though all stimuli in order:
for i, stimulus in enumerate(stimuli):
    if mouse.isPressedIn(stimulus):
        selected[i] = i # keep track of all at 🐭 pos
        if i == current_square: # simple:
            stimulus.setPos(mouse.getPos())
            break # exit the loop, so only one moves

# but need to check if none are selected, or, if there
# is a new selection, move it:
if selected.sum() == -9: # nothing selected
    current_square = -1
elif current_square == -1 or selected[current_square] == -1: # a new selection
    current_square = selected[selected > -1].min() # choose the lowest non-selected value
    stimuli[current_square].setPos(mouse.getPos())