WPF C# Tutorial – Create a Flappy Bird Game in Visual Studio
- Subject: WPF C# Tutorials
- Learning Time: 2 hours
Hi, in this tutorial we will show you how to make a fun flappy bird game in visual studio using WPF and C# programming language. How to create a flappy bird tutorial was one of the first tutorial we did on this website, we are back now with a new one where we will show you how to make a new and improved version of flappy bird using Microsoft Visual Studio, WPF and C#. in this game you will have your standard pipes and a gap between them where the bird will fly through or fail. Scores are judged between how many pipes you can go through. We will also add two small clouds in the background to scroll through as you are playing the game. This will be fun let’s get started.
Lesson objectives –
- Create a fun and engaging flappy bird game in visual studio
- Use the new WPF format to make games
- Use timers, key down and key up events
- Check for collision detections between objects and take appropriate action
- Change rotation of objects using key board events and transform properties
- Using for each loop to identify images using tags in the game
Video Tutorial For Flappy Bird Game in WPF and C#
Download the flappy bird images for this tutorial here
Download WPF Flappy Bird Game Project Tutorial on GitHub
Written Tutorial
Load up visual studio and start a new project.
Call this project flappy bird game and click on ok.
This is the default view of the project. We will make some changes to the XAML and the solutions explorer window.
Importing the images
Download the images from above and right click on the flappy bird game in the solutions explorer.
Hover over Add -> then click on new folder. This will make a new folder inside this project. Rename this folder to images and pressed enter.
Now right click on the images folder -> Hover over Add -> and click on existing item
Make sure you have extracted all of the images from the file you downloaded earlier. If the files are still inside of a ZIP file then visual studio won’t be able to add them to the project. From the file selection window find the folder with all of the images. If they don’t show up inside this box then you can change the file type to image files see in the screen shot below
Once you found them and select all the images and click on Add.
Now you can see the images are now showing in the solutions explorer. Let’s change some codes for the XAMl window.
Go to Page 2 for the XAML code for this game.
Thank you very much from Russia! You are amazing web-teacher!) I loved it!
I had some trouble because I named my project something else, but once I fixed that it worked great! Great tutorial!