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

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

NVitanovic
Views: 2013358
Like: 22087
C++ Tutorial 18 – Simple Snake Game (Part 1)

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 structure the code of the game and do some basic drawing in the console.

Source code:
Finished game:
Download link for visual studio 2012 express:

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)

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. This is exactly why C++ never caught on in the mainstream. No reason this game couldn't be created with a GUI library, but nah. Programming in C++ is the equivalent of running Linux so you can surf the web.

  2. Does anyone else think his voice sonds quite a bit like Bossfer's?

  3. Hi, thanks for a well made tutorial, I subbed in the first minute, job really well done! However, I have a question: I followed this tutorial (up to 9+min mark) twice in a row following your instructions blindly, sans box you drew for explanation, and after running it both times I got the same message saying "expected initializer before 'const'. Whereas your code runs, my doesn't, even though our consoles look the same, please, what am I doing wrong? Total beginner here

  4. how did you open this app visual Microsoft

  5. Bro the source file link is not working now if anyone can give me source code plzz help me out

  6. the source code link don't load can someone give me the source code

  7. does anyone know why I get C26812 The enum type 'eDriection' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).

    enum eDriection { STOP = 0, LEFT, RIGHT, UP, DOWN };

    eDriection dir;

    void Setup() {

    gameOver = false;

    dir = STOP;

  8. Hey i am using vs code for this and encountered infinite loop in printing borders..plz help

  9. my prgoram is running in vs code terminal can anyone tell me how to fix that ?

  10. It says cout and endl are undeclared identifiers, I'm a noob, so can someone tell me what this means and how to fix it?

  11. I use a book to learn c++. But I do the same as in the book is written but it dont works. Its Just the beginning and I feel like an Idiot who cannot do this.

  12. Yeah I entered the same codes you did but I got 2 errors
    One says “error: ‘rand’ was not declared in this scope”
    And the other says “error: ‘system’ was not declared in this scope”

    Please help and thank you

  13. Can anyone tell me how to set up the local debugger?

  14. any idea what

    sh: cls: command not found

    means? im using CLion if that helps?

  15. very useful project to learn C++. Thanks!

  16. Hello there 😀
    I really enjoyed this tutorial man! Thanks for sharing experience.
    I just wondered are you from Serbia because you sound like that? I'm from Serbia 😀

  17. Thanks for all the efforts.. I laugh each time u say We have something not good:)

  18. Can someone please give me a quick response?
    I just tried this game and the boarder didn't stop moving. Why???

  19. Just tested the code in vscode and wondering why the walls aren't placed properly and turns out I haven't saved it lol

  20. tbh, im just here to see how the experts do it their own way, i'm a begginer at C++ and prolly noob.
    but this video motivates me to learn and practice harder (since i'm self taught), now i realize i have a loooong way to go. and it makes me excited. 🔥

  21. Hey, wonderful videos!
    This is my first C++ program, and my first game period and watching your instructions is actually extremely fun and helpful.

    That said, I've hit a snag…

    I keep getting error code LNK2019:

    "unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)

    C:UsersDZRDesktopC++ ProjectsSimple snakesMSVCRTD.lib(exe_main.obj)

  22. LNK2005 "bool gameOver" (?gameOver@@3_NA) already defined in function.obj
    Anyone else got this problem?

  23. You wasn't kidding when you say it "flickers a littler bit"

  24. okay so the width doesn't actually end up being 20 because of the borders. the height is still 20 but the width ends up being only 18

  25. Hey, system("cls") is not working on my PC even thought I have recreated the code from the snake videos to the last detail. Any ideas what could be the problem?

  26. 🙂🙂so much difficult just learned some basic on c++.I think i should not take cse in unergrade

  27. Me im new i had begin today to learn linguage c ++ hope al will be ok hehehe

  28. "The rand() was not declared in this scope"
    Then
    "In function 'void setup()':"
    Errors are here, how to fix it??

  29. Tutorial is great. How did you get rid of the text cursor? On my computer, it shows up all over the screen.

  30. Hey buddy…Code link is not working. Can you please share the code somewhere else?

  31. Hello man. The code isn't running on vs code. I have tried but it keeps showing an error at the void setup function, the x, y, fruitX,fruitY and the tails. Please help.

Leave a Reply

Your email address will not be published.