A few months ago, I purchased a book called Code the Classics from Raspberry Pi Press. This fantastic book explores various classic games like Sensible Soccer and Centipede. Moreover, it guides readers on how to develop Python clones of these games. In total, the book covers five games. You can freely download the book from the provided link and access the game source code on GitHub at https://github.com/Wireframe-Magazine/Code-the-Classics.
Unfortunately, the book does not provide detailed instructions on how to build these games. Nevertheless, it serves as an excellent starting point for anyone interested in Python game development.
Recently, I found some time to delve into this project, and the first thing I needed to do was install Pygame Zero - a library for creating games with Pygame.
In theory, installing Pygame Zero is simple. You just need to use pip
by running the following command:
pip install pgzero
However, I encountered some difficulties on my Mac. The installation failed with the following error:
fatal error: 'SDL.h' file not found
#include "SDL.h"
^~~~~~~
1 error generated.
After investigating the issue, I realized that it might be due to a version requirement mismatch, possibly caused by recent library releases. To resolve this problem, I had to install the latest version directly from GitHub using the following command:
pip install git+https://github.com/lordmauve/[[email protected]](/cdn-cgi/l/email-protection)
Once I did this, everything worked perfectly!