I trying to design an game which works somewhat like a rubix cube. In my app if the A key is pressed the squares in the top row are supposed to move from right to left. So the square in the top right corner moves from the forth position to the third place, the third position to the second and so on. This seems to work ok until the third move. where the colour disappear and then reappears in the second spot when the A key is pressed for the 4th time. Also the first square A1 never seems to be part of the sequence. The data in the array seems fine. Is this a bug in my code or a scratch bug?
Found the answer, the switch_costume command was executing faster than the function to update the array. As a result the wrong colour was displayed. I added a wait command to each sprite to create a delay.