In this project, I am experimenting with snake-like motion. Here, the snake follows the mouse pointer, and when it eats the apple, it grows a little.
The project requires each clone to have its own variable, indicating its clone-number. Scratch doesn't support separate variables for clones, so I used a kludge: The direction of each clone is being used to store its clone number. Its next (x,y) location is obtained by looking in the lists xvals and yvals. The position in the lists is given by the value stored in its direction variable, which never changes. At each iteration, the lead snake segment inserts its location as item 1 in the lists xvals, yvals, thus shifting all of the values down one in the list, so that each segment's new position is the position of the segment ahead of it, one step ago. Scratch bug: once the length is 185 clones or so, a purple dot appears in the middle of the screen, and just stays there.