Hey, Programmer In this article I’m gonna provide you with the free source code of the flappy bird game using the python pygame module. You can use this source code to learn pygame module. Moreover, you can add this game to your portfolio or use it as a project in your school or college.
Doing project-based coding helps you to understand the concepts better. Secondly, it will level up your programming skills. So use this project to understand how to make 2D games in python. like this one Flappy Bird using Python.
So in this post, I have provided the source code of the flappy bird game and how to install the required packages or libraries like python pygame is which necessary to build games on python
Before downloading the source code you have to know about pygame module. Your Computer requires pygame module to run the code.
Step 1 pygame
pygame is a free and open-source cross-platform library for the development of multimedia applications like video games using Python. It uses the Simple DirectMedia Layer library and several other popular libraries to abstract the most common functions, making writing these programs a more intuitive task.
How To install pygame ?
First Of All, You need to install python on your computer. Download python click here to download any version i might not suggest you to go the latest version of python. Download 3.7 or later versions.
pip is used to install packages in python. in order to install pygame on your computer write the below code in your cmd or terminal.
pip install pygame
Step 2 Get the Source Code
After installing pygame now download the source code Click Here To download the zip file.
Note: “If you get an error in downloading the file. make sure you are login with your google account in order to download files from google drive. For security reasons it may happen with you. or you can just open the link in the google drive android app.”
Step 3 Extract & Run
After downloading the zip file Extract With winrar or 7zip which ever you want to use.
After extracting the file Run main.py
So, if you have followed the steps properly from installing python to pygame, then all you need to do is double-tap on main.py which you will get from extracting the flappy bird project source code file. You can also double-tap on the main.py file or open it with your default python idle. Default python idle comes preinstalled when you install python on your computer.
Moreover, you can use different Ide like pycharm or vscode to run the python file. main.py file is python file in which python code is written. in it we have imported required libraries like pyame. and don’t worry the code is well commented which helps you to understand almost every single line of code.
In that flappy bird source code, there is one folder called gallery which consists of game assets like birds and object images and sounds. which is rendered or imported to the game with the help of pygame code written in the main.py file.
Also Don’t forget to check, Super Mario Game using Python. ,
python project ideas for beginners [2021]
Hi,
I tried your code however when I click it doesn’t active the game? am I missing a download feature as I only just installed pygame?
thanks,
Henry
what error it showing
Thanks for sharing this code
your welcome