The way my current program works is that when the snake eats an apple, length gets added to the snake. But the way the length follows the snake is that it is always behind the head in a straight line. How would I make it follow the snake or follow the length in front of it like a normal snake game?
This is my code when I am adding length to the snake.
for i in range(lengthAmount):
if i == 0:
previousx = snakex - (30 * i)
previousy = snakey
if direction == "left":
previousx = snakex + (30 * i)
previousy = snakey
elif direction == "right":
previousx = snakex - (30 * i)
previousy = snakey
elif direction == "up":
previousx = snakex
previousy = snakey + (30 * i)
elif direction == "down":
previousx = snakex
previousy = snakey - (30 * i)
pygame.draw.rect(window, (0, 175, 0), (previousx, previousy, 30, 30))