Hi all, I'm creating a top-down 2d snake-like game.
Basically, the player controls the head and has to go around collecting body parts.
I've already managed to get the body part to follow the head when it gets close enough.
`if(Vector3.Distance(objPlayer.transform.position,transform.position)<2f) {
A technique would be to apply the SmoothFollow script (it's one of the Unity's camera scripts) to the object that follows preceding body part.
Head <- body part1 <- body part2 <- body part3, etc.
Having programmed this exact game years ago when the language for doing so was CBasic I can tell you that the most common way it was done was to create an array of body parts and reposition the “tail” to the new “head” at the time. This was possible because it was ASCII graphics and there was nothing more than just solid filled squared. Thus, you created the illusion of movement by only changing the position of one object.
Depending on how low-key your graphics are, you might be able to do something similar. Or anyone else who ends up seeing this answer for this problem, for that matter.