Skip to content
Advertisement

Python Snake Game snake does not follow

I am creating Snake game in pygame using Sprite logic

how do i chain the movement of the snake? another question on this has been answered here but i cant apply it to my code: see here

the minimal example above works. try it first and you will see my issue :) the snake grows on collision with the red food… but its movement does not chain

thank you

JavaScript

Advertisement

Answer

See the answer referenced in your question How do I chain the movement of a snake’s body?.

You need to use the 2nd solution and adjust the function that creates the snake body. The new function needs to update the positions of the Snakes body Sprites:

JavaScript

Example based on your (revised) code:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement