Not able to make two images go in a loop, and the mouse component does not make the routine end correctly

These threads might have your answer