
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.
13.01.2022
Cool tutorial. Fast, functional and fun. Sub and like.
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 😉
Fun fact: snakes doesn't eat fruits
Are u Available to hear my Ques.
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!!!
HOW TO CHANGE MOVEMENT SPEED!!!
HOW TO CHANGE MOVEMENT SPEED!!!
HOW TO CHANGE MOVEMENT SPEED!!!
HOW TO CHANGE MOVEMENT SPEED!!!
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
My problem is when the snake is going Up and Down, the movement is faster than going Left and Right. Someone help me please
Snak tail not accor…
Thanks a Lot .
Are bhai mera to error aa rha h ki dir not declared , left right,etc not declared kya kru m
what is the name of the theme song used at the beginning of the video ?
I didn't work with me
Why
Someone answer me please😧
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
can u explain the input() and logic() processing ? i did,t undershtand that!!
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
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.
In the last video there is a meskate in ("hello word"*) number()
can this still work if you use a integrated terminal within vs code??
After watching this video i can print hello world😂
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
Thanks ❤❤
can anyone explain why my F goes outside the walls even though i did everything as it is???
This codes are awesome can you please send them to me on this number🙏🙏
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
Using enum dir was very clever, we can specify heads of the snake, using > , < , ^ , V .
its like infinite loop in vs studio code
this was fun thanks!
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;
}
thanks a lot! this is my first mini project
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?!
this is art.
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.
How can we stop that flickering ?
bro like thank you smmmm u helped me sooooooooo bad
Thanks for great stuff, most helpful.
Can we somehow prevent the flickering?
why does my cursor not move the way it does in the video?
How to make speed less of snake? Help me
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.
Do I have to license it to redistribute it?
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
love it!! how can I prevent it from flickering?
Error:Id returned 1 exit status
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