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

Full Form1.cs code –


bullet.cs – bullet class full code


13 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.

  4. Syed Jawad Asghar says:

    my zombie sprites are not moving and game is not getting over i have done exactly what is done in tutorial but it not working please help with this. i am using visual studio 2015

  5. IceAndFire says:

    tnx so much, i wanted to make this type of game so long time, i never knew how, thanks so much sir

  6. Mạnh Đỗ says:

    Hi, I really love your tutorials, but may I want to ask you something: Can I make a scoreboard or save high scores ?

  7. tal says:

    what is lt ? its not in the variables…… on the bullet class if (Bullet.Left & lt; 16 || Bullet.Left & gt; 860 || Bullet.Top & lt; 10 || Bullet.Top & gt; 616)

  8. Tim says:

    thx for the tutorial. it was very usefull in getting the basics down. Ima making a game during my post college boredom 🙂

    Sept 2019

  9. Muwux says:

    Hi, how would you add health? I got added but “health” forever spawn.

  10. milk says:

    Hi, i got an error like this ” possible unintended reference comparison to get a value comparison cast the left hand side to ‘string’ ” in foreach (Control x in this.Controls) and foreach (Control j in this.Controls). Please help me

  11. Vishal Kumar Tigga says:

    I have really liked the content over here, it literally hooked me into this gaming industry, copied and typed all the code but a bug is keep on coming.
    all the directions of the game are working except when i face the downside, my bullets doesn’t come out. it will stay in the ground and when i move from that particular place I can see that the bullet is there lying on the ground. can you help please

  12. Anhar Ali says:

    Hi, I’m glad you liked the tutorial. It sounds like the bullet class is probably missing the directive to move it downwards when its created on the form. Check the spelling is the direction is the same one that’s being passed through the class. So when the key is being pressed down see if the facing string is the same as the one you coded in the bullets class.

  13. Fariha Afrin Khan. says:

    I’ve typed the codes, and fixed errors and have emphasize this project idea adding some of my own concept of Design Tools and with new coding blocks for those Tools in main Form 1.

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

%d bloggers like this: