Yesterday I posted this question trying to learn how to make my SnakeBody class follow my SnakeHead class in my Snake clone. Today I’d like to see if anyone has any suggestions on how to implement an alternate method. I saw this video of “Pix the Cat” and I’d like to see if I can get the SnakeBody instances to follow my SnakeHead player, much the way the ducks follow Pix the Cat. I’d like to dynamically add SnakeBody elements to the SnakeHead, or even subtract them if I decide to add powerups/powerdowns to the game.
Is there any easy, elegant solution I’m missing on how I can get actors to follow the player precisely, following the exact path the player has taken?
Since you are specifically referencing 2D gameplay however, I think you might get more out of solution Two: Maintain a history of points that you (the head) have traveled, and have each child actor follow them in turn. This is especially easy if you use grid constraints like the video you have there (basically, you just need to store off your grid node history).