Figure 1 Preview of Flappy Bird Game
Result of Flappy Bird Porting Game Project, requirement for pass Comprehensive Programming Class in Nanjing Xiaozhuang University. Developed using C++ and Python.
Figure 2 Flappy Bird Logo
Projects Name : Flappy Bird
Creator : Patricia Fiona - 王佳佳
Student ID : L20253009
Type : Final Project (Nanjing Xiaozhuang University)
Platform : PC
Programming Language : [C++](https://isocpp.org/) & [Python](https://www.python.org/)
Disclaimer : This projects is only for study purpose only!
Here I using Visual Studio 2019 for running the C++ project with SFML. The steps that you must prepare for running this project are:
- First, you must download the SFML SDK from the download page. You can then unpack the SFML archive wherever you like.
- Open the C++ game project in Visual Studio
- Open project properties by right click in the project name
Figure 3 Open Properties by Right Click in the Project Name
-
In the project's properties, add:
- The path to the SFML headers (/include) to C/C++ » General » Additional Include Directories
- The path to the SFML libraries (/lib) to Linker » General » Additional Library Directories
These paths are the same in both Debug and Release configuration, so you can set them globally for your project ("All configurations").
Figure 4 Set the SFML include Location
Figure 5 Set the SFML lib Location
-
The next step is to link your application to the SFML libraries (.lib files) that your code will need. SFML is made of 5 modules (system, window, graphics, network and audio), and there's one library for each of them.
Libraries must be added in the project's properties, in Linker » Input » Additional Dependencies. Add all the SFML libraries that you need, for example "sfml-graphics.lib", "sfml-window.lib" and "sfml-system.lib".
In this project we will add this libraries:
- sfml-graphics-d.lib
- sfml-window-d.lib
- sfml-system-d.lib
- sfml-network-d.lib
- sfml-audio-d.lib
Figure 6 Set the SFML lib that We want to Use
- Because here I use dynamic version of SFML, we can save the setting by click Apply and Ok.
-More Details about the setting can be seen in SFML Official Website (https://www.sfml-dev.org/tutorials/2.5/start-vc.php)-
- Now you can run the game
Here I use conda environment that use Anaconda App to create python game environment. If you don't have Anaconda App, you can still prepare the environment by using the steps that you can search by yourself and make sure that you already have Python in your computer. The process of preparing the enviroment can be seen in the bottom instructions:
- Open Anaconda Prompt
- To create an environment:
conda create --name {NAME_OF_YOUR_ENVIRONMENT} python=3.8
For Example:
Figure 7 Create Python Environment with Conda
- Activate your Environment by running this code:
conda activate {NAME_OF_YOUR_ENVIRONMENT}
Figure 8 Activate Conda Environment
- Install PyGame in your environment by running this code:
pip install pygame
OR
conda install -c cogsci pygame
Figure 9 Install PyGame Library in Environment
- You can check your list of libraries by running this code:
pip list
Figure 10 Checking List of Libraries in Environment
-
Open the Python Project in Visual Studio
-
Choose the Environment by choose Add Environment
Figure 11 Add Python Environment in Visual Studio 2019
- Select 'Existing Environment' ->>> From the Environment section, select 'Your Envirnoment' ->>> And Click Add
Figure 12 Add your Environment to the Project
- Now you can run the game
Action | Result | Action | Result |
---|---|---|---|
C++ Preview | Python Preview |