Setup
All you need for this project is the Getting Started Kit.
Install Pygame Zero
In order to use Pygame Zero, you first have to install it. You do this in the same way you previously installed the Phidget22 library. Simply navigate to your package manager, search for pgzero and press install!
PyCharm
If you're using PyCharm, select File > Settings > Python Interpreter and use the + symbol to install pgzero.
PyScripter
If you're using PyScripter, select Tools > Tools > Install Packages with pip and enter pgzero.
Create Project Structure
Create a python script called flappybird.py in a location of your choice. Download the required images here and place them in a folder called images in the same location as your python file.
Write code (Python)
Copy the code below into your python script flappybird.py.
Code Review
Pygame Zero uses event hooks to allow programmers to easily create games. In this example, we are simply copying the functionality of the on_key_down hook and using it in our button's state change event.
Practice
- Add new functionality to your game using the green button. Some examples may be pausing the game, ending the game, speeding the game up, slowing the game down, etc.