Snakes like to eat apples. At least in the game you are about to code.
We just published a course on the freeCodeCamp.org YouTube channel that will teach you how to create a snake game using Python and Pygame.
This course was developed by Dhaval Patel from the popular codebasics YouTube channel.
This course is for beginners. All you need to know is basic Python. You will learn to build a complete end-to-end project in Python.
Here are the sections in this course:
- Create the game surface
- Converting into OOP
- Moving block with timer
- Draw snake and apple
- Snake eats apple and find score
- Game over logic
- Add background music and image
- Convert python to .exe
Dhaval created this course in both English and Hindi—and we released both of them! You can watch the English version on our main channel and the Hindi version on our Hindi channel.
Use arrows to play this game.
You can also watch the full 90 minute course below.