WPF C# Tutorial – Create a Flappy Bird Game in Visual Studio

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 –

  1. Create a fun and engaging flappy bird game in visual studio
  2. Use the new WPF format to make games
  3. Use timers, key down and key up events
  4. Check for collision detections between objects and take appropriate action
  5. Change rotation of objects using key board events and transform properties
  6. 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.

mooict flappy bird wpf c# tutorial - project window

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.

mooict flappy bird wpf c# tutorial - visual studio window layout

Importing the images

Download the images from above and right click on the flappy bird game in the solutions explorer.

mooict flappy bird wpf c# tutorial - make a new folder in visual studio 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

mooict flappy bird wpf c# tutorial - add existing items to the new images folder created

 

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

mooict flappy bird wpf c# tutorial - import the game assets

Once you found them and select all the images and click on Add.

mooict flappy bird wpf c# tutorial - game assets included conclusion

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.




2 responses to “WPF C# Tutorial – Create a Flappy Bird Game in Visual Studio”

  1. Дарья Марахова says:

    Thank you very much from Russia! You are amazing web-teacher!) I loved it!

  2. jwnolan says:

    I had some trouble because I named my project something else, but once I fixed that it worked great! Great tutorial!