C++ Tutorial 18 - Simple Snake Game (Part 3) - playproduction.de

C++ Tutorial 18 – Simple Snake Game (Part 3)

NVitanovic
Views: 504580
Like: 7007
C++ Tutorial 18 – Simple Snake Game (Part 3)

Welcome to my simple game tutorial on C++. In this tutorial i will going to show you how to make a fun snake game.

We will finish our game, by adding a tail to the snake, and polishing the code up a bit.

Source code:
Finished game:
Mirror link:

Great C++ books that I recommend for beginners:
C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart (3rd Edition)

C++ Primer Plus (6th Edition) (Developer’s Library)

Programming: Principles and Practice Using C++ (2nd Edition)

Download link for visual studio 2012 express:

If you have any questions I’ll be glad to answer, please leave a comment on the video.

Thanks for watching and please subscribe.

500 Comments

  1. Cool tutorial. Fast, functional and fun. Sub and like.

  2. Thanks for making this little tutorial series. I jsut started with C++ programming, and didn't really know where to begin after I finished a C++ tutorial, but this really helps with getting to know the basic things, and making them useful. Your tutorial is appreciated even 5 years later 😉

  3. HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!HOW TO CHANGE MOVEMENT SPEED!!!

  4. HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!
    HOW TO CHANGE MOVEMENT SPEED!!!

  5. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  6. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  7. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  8. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  9. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  10. My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please

  11. Are bhai mera to error aa rha h ki dir not declared , left right,etc not declared kya kru m

  12. what is the name of the theme song used at the beginning of the video ?

  13. I didn't work with me
    Why
    Someone answer me please😧

  14. Watching this in 2021 with my ryzen 9 5900x playing on extreme difficulty because of how fast it is

    Yes I added a sleep function now and set it to 50 because i'm slow

  15. can u explain the input() and logic() processing ? i did,t undershtand that!!

  16. Thank you , this is the first tutorial which simply and correctly introduces me to programming a sprite and controls, i dont yet understand what is written there to be honest and i have no idea how you came up with that but i now have a chance to study this code and understand the logic behind it , thank you

  17. Hey not sure if you still monitor this video or not.. or if anyone else can help me. I've completed all 3 tutorials and I've had the same bug from the first video with drawing the board over and over. I'm stuck in a loop drawing the board (with the fruit and snake and score printing) but it just draws endlessly.

  18. In the last video there is a meskate in ("hello word"*) number()

  19. can this still work if you use a integrated terminal within vs code??

  20. After watching this video i can print hello world😂

  21. dident understand this ——————-

    for (int i = 1; i < nTail; i++)

    {

    prev2X = tailX[i];

    prev2Y = tailY[i];

    tailX[i] = prevX;

    tailY[i] = prevY;

    prevX = prev2X;

    prevY = prev2Y;

    }

    someone explain

  22. can anyone explain why my F goes outside the walls even though i did everything as it is???

  23. This codes are awesome can you please send them to me on this number🙏🙏

  24. can u make the video of same game using graphics.h header file as there is a lot of flickering when we compile the code. Please make a video on that

  25. Using enum dir was very clever, we can specify heads of the snake, using > , < , ^ , V .

  26. its like infinite loop in vs studio code

  27. Can someone please explain this part to me PLEASE!

    int prevx=tailx[0];

    int prevy=taily[0];

    int prev2x, prev2y;

    tailx[0]=x;

    taily[0]=y;

    for(int i=1; i<ntail; i++)

    {

    prev2x=tailx[i];

    prev2y=taily[i];

    tailx[i]=prevx;

    taily[i]=prevy;

    prevx=prev2x;

    }

  28. Hello, it worked for me up until this part. now the inputs don't work. i even tried the downloaded version and it doesn't work. help?!

  29. I'm still learning c++ and while watching this I'm smiling. It looks pretty cool. This encouraged me to practice code every day, thank you, man.

  30. bro like thank you smmmm u helped me sooooooooo bad

  31. Thanks for great stuff, most helpful.

  32. why does my cursor not move the way it does in the video?

  33. How to make speed less of snake? Help me

  34. That is nice project buy when I tried it's not letting me play like when I open it , it says press any key to close windows…… idk how to fix it , its been a while I am trying
    otherwise the gameboard , snakehead, fruit is there but can't play.

  35. Do I have to license it to redistribute it?

  36. Fun little project thanks man! Does anyone know how I can increase the size of the playing box? When I try to change
    const int width = 20;
    const int height = 20;

    to something like
    const int width = 40;
    const int height = 40;

    it glitches out and wont work. Can anyone explain why to me? I would think that would just increase the height and width, but guess not lol

  37. love it!! how can I prevent it from flickering?

  38. hello sir
    i have seen the complete playlist and write the code also error free but still there are some problems in my code when it runs please help me
    also anyone else reading this comment if he can help please help

Leave a Reply

Your email address will not be published.