What I'm trying to make is a dragon with a segmented body in which each segment follows the one before it. The head is obviously going to be the autonomous piece that the others follow. If possible, when one segment is destroyed, I might want to be able to splice a piece out and "shrink" the monster down.
I get that they'll all have to be in the same array with each one behaving in accordance with the segment in front of it. I suppose that I could also handle "rotating" the pieces by checking for movement and for which side the preceding piece is compared to the current. Like, if the preceding piece's x value is greater than the current piece, it will turn into the same direction. I'll figure that in time.
The thing that I don't really get is how to even make a path for all of the segments to follow. Not a straight line path. Say if I want the head to ease up and down slightly as it moves left. How do I make the piece behind the head follow the exact path that the head just traveled on? Would I want to make an ever-updating array of values for x and y positions that the pieces would just move to?
Any ideas are helpful.