简体   繁体   中英

Need help for a Python Snake game

I'm currently creating a Snake game on Python using the TKinter library. So right now, I've implemented the movements, the food system, and the score system. I still need some help on how I can make the snake grow when it eats the food.

I do not see the associated code that actually displays the current position of the snake on the screen and remove it after movement, but this is where you can change the size if you make the length of the snake variable and have it drawn and removed in an iterate fashion. When food is eaten, you can simply increase the size of the snake length variable and pause the erasing of the snake movement as it proceeds along its vector until the desired growth has occurred, at which time removal can proceed at the new length rate. Please clarify the part of the code that actually renders the snakes position.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM