Good question, I have no idea but thinking about it, I'm guessing you would need an array to store the previous locations. Kind of like storing old velocities, but the really hard part is figuring how to move them again when the snake head pulls the slack. You would also have to move those pieces along a stored vector.
I'm not really sure what you want, but have a look at this program. Each segment's location is stored in an array. On each movement, the old tail segment is erased and a new head segment is drawn, creating the illusion of movement.
This version uses sprites. You'll have to play around with the formulas that determine where it's going to move. Right now they produce variable distance between segments, which causes a kind of creepy movement - like a centipede in a box trying to get out.
Ignore the 'Randomize Each Point comment, looks better in a spiral
So basically whats happening is youre stepping through each body piece, all the way till you get to the tail, and each body piece only keeps track of the angle between it and the body piece before it, and so all you allow is the angle to be changed, not the position
Then moving the head will move the body, giving a weird worm feel
Set XSCREEN to 4
Initialize the radius R[i] to a constant number, 5
And add +1 to the Y[i] to add a form of linear gravity
And you'll see how strangely this snake follows the laws of physics
If you make a circle loop in the body, the loop will remain active and 'roll' down the snake chain until its released at the tail
Its a really interesting programming phenomenon
That's weird. Can you recreate this with sprites and make them rotate to make it seem more "natural"? I've been trying to recreate the worms from Terraria with little success.