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.

Nguồn: https://haitivolunteer.org

Xem thêm bài viết khác: https://haitivolunteer.org/game/

46 Comments

  • Blue Rust
    Posted June 14, 2020 11:37 am

    you get straight to the point!! You don't spend half an hour talking about why coding is important. Ty man

  • best bottle
    Posted June 14, 2020 11:37 am

    i think to use random function we have to use #include <cstdlib> …but he didn't use it .. why?

  • Mr. Caveira
    Posted June 14, 2020 11:37 am

    my visual studio says that it doesn't recognize: identifier "end1" is undefined

  • kiPRO BRoos
    Posted June 14, 2020 11:37 am

    Da li si ti mozda sa Balkana? Poz.

  • Nazish Nazish
    Posted June 14, 2020 11:37 am

    Pls tell me why we use the bool game over

  • Ryan Cao
    Posted June 14, 2020 11:37 am

    why does the finished game link to go porn

  • Gonzalo Rosario
    Posted June 14, 2020 11:37 am

    Im use to code in game maker studio, I found your tutorial very nice to a pure c++ introduction. Great Work!

  • MooN
    Posted June 14, 2020 11:37 am

    акцент похож на русский

  • mario kart
    Posted June 14, 2020 11:37 am

    To those of you on unix, I provide this snake game ported to ncurses!
    https://pastebin.com/uJF4AqUy
    (note, if you're compiling with gcc make sure you use "-l ncurses" or you'll get a linker error)

  • Animal king
    Posted June 14, 2020 11:37 am

    That website in the description is crusty.

  • Fell Man
    Posted June 14, 2020 11:37 am

    0:40

  • MarkoXyz
    Posted June 14, 2020 11:37 am

    Thanks for tutorial. Are you from Balkan

  • Eu Da,eu
    Posted June 14, 2020 11:37 am

    error: use of undeclared identifier 'sleep'
    sleep(10);
    ^
    what
    i'm on linux

  • Black Engineering Student
    Posted June 14, 2020 11:37 am

    Another way to write the inner loop for the two side walls is
    if(j == 0 || j == width – 1)

    cout<<'#';

    else cout<<" ";

  • Nitish kumar
    Posted June 14, 2020 11:37 am

    Can you please tell me how can I set up my vscode for c++ coding

  • Sufy zed
    Posted June 14, 2020 11:37 am

    can anyone else hear 2 girls 1 cup in the intro music 😂

  • Aliah Mawadah I8I0I2I5
    Posted June 14, 2020 11:37 am

    I like your content, but you exhale too much and that sounds quite annoying..

  • olimp 006
    Posted June 14, 2020 11:37 am

    Are u Russian?

  • Tech Support & Gaming With Jawad
    Posted June 14, 2020 11:37 am

    how to stop that flicking
    help

  • Channel Tamvan's
    Posted June 14, 2020 11:37 am

    P

  • Muhammad 'Ammar
    Posted June 14, 2020 11:37 am

    Hi, can you provide the link for me to download the c++ for free? I am interested to learn! Thanks

  • gamer
    Posted June 14, 2020 11:37 am

    thank you soooooooooooooooooooooooooooo much for your lesson

  • Arnold Imreh
    Posted June 14, 2020 11:37 am

    Very helpfull man I love you!

  • T.A.M
    Posted June 14, 2020 11:37 am

    jel si ti sa balkana brate

  • GD Spam King
    Posted June 14, 2020 11:37 am

    i like making games because you can add ANYTHING

  • Goose Moose
    Posted June 14, 2020 11:37 am

    i don't understand void someone explains
    pls

  • Pickle Zim
    Posted June 14, 2020 11:37 am

    1:35

  • 𝔾𝕒𝕞𝕖𝕣𝕚𝕤𝕒𝕒𝕔2011
    Posted June 14, 2020 11:37 am

    Does it work On Mac?

  • newraozx
    Posted June 14, 2020 11:37 am

    Loved the contents simple and straight to the point..please uploading !

  • BOT 1
    Posted June 14, 2020 11:37 am

    Ummm I think your first link gave me a virus. Did u put that there?

  • Viktor Kocián
    Posted June 14, 2020 11:37 am

    I am using Clion in Linux and system("clear") doesn't work in terminal(IDE, Linux Terminal).

    I am desperate, I can't figure it out for days.
    Any idea?

  • Vimla Pandey
    Posted June 14, 2020 11:37 am

    Couldn't even make the boundary

  • Lukshery456
    Posted June 14, 2020 11:37 am

    rand() does not work for me

  • Cracker The First
    Posted June 14, 2020 11:37 am

    Hvala Nidzo 🙂

  • Salah Alshafey
    Posted June 14, 2020 11:37 am

    for Draw() function, i think this might be better:-

    system("cls"); // we must #include <iomanip> (header file)
    cout << setfill('#') << setw(width) << "" << setfill(' ') << endl;
    for (int i {0}; i<height; i++)
    cout << setw(width/2) << left << "#"<< setw(width/2) << right << "#" << endl;
    cout << setfill('#') << setw(width) << "" << setfill(' ') << endl;

  • The Robloxian Channel
    Posted June 14, 2020 11:37 am

    5:01 Saved.

  • Wim Harris-Ryden
    Posted June 14, 2020 11:37 am

    prob dumb question but I cant build past the firs function put in and the log just says setup was nont declared in this scope any suggestions (side note* im using code::blocks)

  • Frederick Sims
    Posted June 14, 2020 11:37 am

    Can anyone tell me why only half my map is showing up?

  • J i t H
    Posted June 14, 2020 11:37 am

    Jst a correction.
    At lime 33 tht cout " " happens regardless of any condition so we have extra 2 blocks… so putting tht under a if else condition will fetch u an exact 20*20

  • Nila Balasubramanian
    Posted June 14, 2020 11:37 am

    Video clarity is not good its somewhat blurred.l am not able to see the screwn clearly

  • Krishnadev Unni
    Posted June 14, 2020 11:37 am

    Thank you thank you so much

  • shivanshu sanjeev
    Posted June 14, 2020 11:37 am

    Why is it moving diagonally only and w and s dosen't work

  • irakli imesashvili
    Posted June 14, 2020 11:37 am

    when i use the rand code fruitX= rand() % width; it says that rand was not declared in the scope

  • Mukesh Kumar
    Posted June 14, 2020 11:37 am

    please make more videos

  • HAV FUN
    Posted June 14, 2020 11:37 am

    Hi I'm beginner in C++ and I followed the exact steps showed in the video. However I'm getting the error messages saying the this and that variables was not declared in this scope. Please help.

  • Nguyen Chi Bal B1509558
    Posted June 14, 2020 11:37 am

    Please, can we connect between C++ with PLC ?

Leave a comment