c++ – Snake movement logic 2d Snake game

I am working on my snake game in C++ with SFML, now comes the part where I need to update the snakes body after the head has moved. Here’s the problem.

  • The distance the head moves is not the size of one part of a snake, because this doesn’t let the movement look smooth, so I instead move a smaller distance and update the direction when position % size == 0 This makes the movement so much smoother
  • Due to this, each body part should also move the “smaller distance” and not jump into the position of its next part because that will be basically moving each part the distance of the size

Now if I have to update the body I need to make a lot of checks to determine the correct change in position . How can I tackle this?