× Main Menu

C# Tutorial – Create a Zombie Survival Shooting Game in Visual Studio

Welcome to this exciting tutorial. Reminder – this is an advanced tutorial, if you are not comfortable with Visual Studio or C# please refer to some of the easier tutorials to warm up and then crack on with this. Making fun little projects are the best way to learn programming and it makes it fun.

In this tutorial we will show you how to create an awesome top down zombie shooter game in visual studio and using c# programming language. This tutorial is for the advanced users because we will be using classes and objects to manipulate them. Game itself is simple you are the shooter who has limited ammo and zombies will spawn in random places and will come after the player. There is a ammo drop, ammos will drop in various different spots in the game and player needs to collect them.

Lesson Objective –

  1. Create a full top down shooting game in visual studio
  2. Using sprites and methods to change the state of player and zombies depending on the direction
  3. Introduction to Object Orientated Programming (OOP)
  4. Create new class and methods, variables and custom data from that class
  5. Using for Loops to loop through all of the components in the game
  6. Using the pre built classes in C# to add them and remove them from screen
  7. Dynamically create/remove zombies and spawn them across the screen
  8. Dynamically create and remove bullets that shoot from up/down/left/right directions
  9. Dynamically create and remove ammo boxes across the screen
  10. Create a health bar for the player and change colour depending on how much health the player has left
  11. Debug the program

Download the full game assets here

C_Sharp_Tutorial_Zombie_Survival_Shooting_Game_in_Visual_Studio

Full Game Source Code in Page 2 Below




3 responses to “C# Tutorial – Create a Zombie Survival Shooting Game in Visual Studio”

  1. Michael says:

    Hey there i really like this code and ive typed it exactly how you have but for some reason the code ” foreach (Control x in this.Controls)”
    doesnt seem to wkr very well its fine until after the code “”((PictureBox)x).Dispose();// dispose the picture box completely from the program
    ammo += 5;// add 5 ammo to the integer”

    then after that every single x has a red line under it and it says “The name ‘x’ does not exist in the current context” please help

  2. Anhar Ali says:

    Hi Michael, I’m glad you found this tutorial helpful. The x variable is stored in the for each loop line “foreach (Control x in this.Controls)
    {“. This line is starting a for each loop and we are using x as the control method to find the picture boxes. Check if you wrote the for each loop correctly in this context.

  3. Albin K says:

    Visual studio gives me a warning when I type ” x.Tag == “ammo” ” and for some reason whenever I press the “up” key the game pulls me to the top and I get stuck. I can move to the left or right but I can’t go down. The version of Visual Studios that I’m using is 2015.

Comment on this tutorial and let us know how you got on -

%d bloggers like this: