PyGameZero is a beginner friendly wrapper around the powerful PyGame library for writing video games using Python. It’s extraordinarily easy to write an entertaining game in only a few lines of Python code with PyGameZero. For example, the side scrolling chasing game shown in the video below is only 400 lines of Python which were written using Mu.
Mu’s PyGameZero mode provides five buttons but we need only describe two:
The “Play” button knows how to start your game using the PyGameZero framework and, once clicked, turns into a “Stop” button. When your game starts any textual input or output will be contained in the pane added between the text editor and Mu’s footer. Most importantly, a new game window created by PyGameZero will appear on your desktop. This makes it very easy to see, test and check your game is working how you expected it to!
The remaining “Images”, “Fonts”, “Sounds” and “Music” buttons all work in exactly the same way. Your game will need to include assets such as images (for sprites, backgrounds and other things in your game), fonts (so you can write text to the screen in your game), sounds (for sound effects to signal when something has happened in your game) and music (to create an atmosphere for your game). Clicking on each of the four buttons opens the directory into which you should put such game assets (simply drag and drop things into them using your operating system’s file manager).
Once your game assets are in the right place, PyGameZero makes it extraordinarily easy to use them in your game!
Now go read the PyGameZero documentation and make something fun!