Making Classic Games in Python
Python is a great programming language to learn however there’s no denying it’s a step up from block-based programming languages like Scratch.
When teaching Python it’s a big help if you can provide a hook to get new Python programmers interested. You will find that classic games like Candy Crush and Flappy Bird provide a great motivation for students.
As soon as they see that they can create their own version of these classics they are fascinated and ready to get typing.
As well as the game concept you need a friendly programming environment and the Pygame Zero framework and the Mu editor are a great combination. Installing Mu also installs Pygame Zero so it’s easy to set up and get going.
We (the mentors) at Brighton Coder Dojo have created three tutorials:
- Flappy Bird Pygame Zero Tutorial – a great first tutorial including information on how to download and set up Mu together with Python basics.
- Candy Crush Pygame Zero Tutorial – this builds on the skills in Flappy Bird and includes loops, arrays and more advanced logic.
- Pac Man Pygame Zero Tutorial – again building on the skills learnt in the previous tutorials this covers files, dictionaries and (soon) some basic Artificial Intelligence.
You’ll see a range of teaching styles in the tutorials from straightforward instruction (follow this and it will work), to some deliberate bugs that need to be fixed before progress can be made, through to more open ended exploration and algorithm design.
We plan to make more tutorials and would love to hear your feedback, so let us know what you think and if there’s anything you would like to suggest for future editions.
Eric Clack - eric@bn7.net.