@@danielgorokhov3457 thanks,, I watch complete code from your comments and also highlight my mistakes,, again thanks for your reply,, It's amazing code 😍
easy to follow can recreate the code while the video is running. No useless bullshit just straight to the point, i love it. You earned yourself a sub !
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. 🔥
I really appreciate this. I know this tutorial is very old by now, but as someone who is just getting into C++ recently this has been very enlightening to me. Thank you!
I haven't worked with game development in a long time. Thank you for making this video, even though it was over six years ago. More than anything else, I liked that you assumed we knew the basics of programming. Explaining the basics wastes too much time.
@@EinMeister it went great, thanks for asking. In fact that project sparked my love for programming and I'm now studying Artificial Intelligence. It's amazing.
@@EinMeister dude, just make a few small scale games (may be some 2D runners) and then when you're confident learn about AI in games (reinforcement learning). Its so freaking fun! Wish you the best, my friend.
@@uahatoxicboi9801 if j is equal to 0 or j is equal to width minus one then print #. Rather than making two separate if statements he made 1 statement which will print # when either of those conditions are met. The || means or. So that if statement will run if either condition is true
@Bima Pramudya Chill it wasn't that harsh. Anyone can copy code from a tutorial, what shows you've learned something is if you can make something yourself.
For anyone watching this, make sure that in your if statements that you use == to compare. if (j = 0) is setting j to 0, not checking if it is 0 if (j == 0) checks if j's value is 0.
I know only code basics like what a variable or constant is; how to make a calculator and stuff like that but watching this and searching up the meanings of the terms really upgraded my knowledge by a whole lot.
Thank you for the information you provided for me. Im new to this coding and you displayed your program with eaz of my mind! I really respect what you do,and give you all the props that money cant buy! You presentation is better than many of my professors ever taught me! I will subscribe and will follow you. I would like to pay you for some 1on 1 communication, to help me out personally with my idias in the future! Thank you and be blessed
Hello there :D 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 :D
Wow I'm taking up game design and I have a class on c++ and it's my first time ever learning about it. It's a little hard but I understand it. I'll learn as I go.
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
Bro, Just saying but merely copying what someone is doing isn't called programming. It takes years of learning to be a programmer and it isn't easy. Don't feel bad cause my dad used to tell me this when I was small and this is what developed my interest and I took coding as a major. Regards Red Bandit
Red Bandit I’m sorry I just wanted to test it out. As you’ve said it takes years of learning and you are absolutely correct i couldn’t even understand this properly.....
here is a more readable version of the draw function. It is a little confusing when your syntax is inconsistent like in the video with the missing curly brackets and deleting else.. happy coding! void draw(){ system("cls"); for (int i = 0; i
How do you get your window to clear and look like it has motion? I'm trying to build a game of connect 4 and dont want the console window to scroll for every play
Your code is flickering because of the "gameover" variable not being made true at the end. This makes your code to execute repeatedly thus clearing and printing the map forever!!
@@SkiNNyPoNNy would the code be better if you create a multidemintional array and print the # on the first and last indexes of the array ? int array[x][y]; for (int i = 0; i< x; i++){ array[0][ i ] = "#"; array[x][ i ] = "#"; } for (int i = 0; i< y; i++){ array[0][ i ] = "#"; array[y][ i ] = "#"; }
Cool video NV. I didn't know with C++ you could make a very simple game that easily. I assumed you would have over 100 lines of code to start your first very basic game. Also, are you able to make games with C as well as C++? I prefer C++ over C, C++ feels more flexible. At the moment I am taking a break from Kotlin and I am playing around with C++ to try and better understand how the language works and see if I can build a very simple but small game. I am happy I found your channel.
From what I could find from a quick search, clrscr() is an old function that is only included with a header file that comes with some old C compiler. Whereas system() is a C/C++ Standard function, meaning it has to be included in every compiler, and "cls" is just the console command to clear the screen. Apart from that, I think the functions are identical with that as an argument to system().
Ayy lmao, pretty good tutorial you know what I'm sayin. But can you do a meme programing tutorial? I need to step up my meme game ASAP. Thanks dude. Ps sick snake game bruh
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
I know I'm 11 months late and that this might be a dumb question, but why do people prefer writing "++j" instead of "j++" in a For? j++ seems more natural to me, is anything different if you write it the other way around?
if you write "++j" it will add 1 to j before it counts the value of j and if you write "j++" it will count the value of j then add 1 to it. In for loop it doesnt make that big of a diffrence (i think). So if you write this: int a = 0, b = 0; cout
I am using Xcode instead of visual studio on my mac and I encountered a problem telling "TERM environment variable not set." Can you please help me sort it out?
Can somebody help me please? Like when i try to run the code ( which is the same from the video) the game is not looking like in the video ( it appears and disappeara continuosly and it doesnt work moving the snake). Might the problem be the program? Maybe something is not good in my coding program or maybe the problem comes from my pc. ( It happens the same with code blocks and visual studio )
It's a pretty good tutorial but I wish you went more in-depth on what you are doing. Anyone who isn't a complete novice might disagree with me though. Can't please them all but I appreciate this regardless.
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.
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?
Nice. I'm trying to transition from Actionscript 2.0 and people recommended java. But i noticed that C++ could go straight to the compiler and get a better performance.
I'm using visual studio 2010, I did this - File -> New file -> Visual C++ -> C++ File -> open , and I typed in the code. But I don't get the Run button (the tiny right-facing triangle you click), its faded out. HOW DO I RUN THE PROGRAM?
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)
What are we supposed to open the project as? Are we supposed to open it as a Visual c++ Win32 console application? I mean it won't compile and run my code so I'm trying to figure out the problem.
"So if we run our programm now..... we get something that's..not good...."
Bro, i feel you so much
Yea, this is the only guy I’ve seen who’s used that term, sadly.
In snake game part 1 , compiler occur an error that 'rand' was not declared in this scope
Please reply me Please, ,
@@rajahussainabbaxi8940 dude, send ur code here
@@danielgorokhov3457 thanks,, I watch complete code from your comments and also highlight my mistakes,, again thanks for your reply,,
It's amazing code 😍
Raja Hussain abbaxi do you have #include or . Or did u just use rand and forget its rand()?
Tip for all new guys that are here. If you highlight a line of code, hold alt button and use Up/Down arrow keys to move the entire line
You are a good man, thank you.
Legend 🙏
Thanks zaheer. Loved red lotus btw.
Thank you!
wow Thanks
i feel like these sort of tutorials are way better than "programming tutorials" because this guy actually shows us how to use th code we learn
sadly he quit youtube
The difference between learning to code and learning to make a program
easy to follow can recreate the code while the video is running. No useless bullshit just straight to the point, i love it. You earned yourself a sub !
Agreed! (Sorry for the necro)
+Andtp Fack congrats
loser
Andtp Fack I
Anders Hansen Learn C++ before watching the video for fucks sake!
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. 🔥
Same here
same here how is it so far
My brain: What did you just watch?
Me: Programming.
My Brain: So, what did you understand?
Me: Nothing
@dark tv Great advice. Brother I wish everyone understood they do not need to understand much in the first day.
@denisucuuu don't use "using namespace std;". just don't.
dobre
@@yodagaming3003 why though?
@@yodagaming3003why?
I really appreciate this.
I know this tutorial is very old by now, but as someone who is just getting into C++ recently this has been very enlightening to me.
Thank you!
do you have videos better than this
We are on the same boat
same also i think there is gonna be a new person every single year
@@unrevealablegaming2912 guess we share the same year :)
@@kristianuremovic4085 yeah guess so
I haven't worked with game development in a long time. Thank you for making this video, even though it was over six years ago.
More than anything else, I liked that you assumed we knew the basics of programming. Explaining the basics wastes too much time.
if c++ doesnt recognize rand include this: #include
Thanks bro
Now i can run it.
ty bro but now it dont declare "cout" neither "endl"
THE COMMENT I"VE BEEN LOOKING FOR!THANKSSS
see u in heaven boy!!
theen cube for pres 2020
Thanks for the tutorial bro,it motivated me to learn more about C++
This is going to be my first year project (and my first ever game) hopefully it works out. Thanks!
Paul SZ lmao
Did it?
me too
@@EinMeister it went great, thanks for asking. In fact that project sparked my love for programming and I'm now studying Artificial Intelligence. It's amazing.
@@EinMeister dude, just make a few small scale games (may be some 2D runners) and then when you're confident learn about AI in games (reinforcement learning). Its so freaking fun!
Wish you the best, my friend.
Adding 2 units in the for loops to make the first and the last line of the map could be replaced with the
this is the code #include
#include
#include
#include
using namespace std;
bool gameOver;
const int width = 20;
const int height = 20;
int x, y, fruitX, fruitY, score;
int tailX[100], tailY[100];
int nTail;
enum eDirecton { STOP = 0, LEFT, RIGHT, UP, DOWN};
eDirecton dir;
void Setup()
{
gameOver = false;
dir = STOP;
x = width / 2;
y = height / 2;
fruitX = rand() % width;
fruitY = rand() % height;
score = 0;
}
void Draw()
{
system("cls"); //system("clear");
for (int i = 0; i < width+2; i++)
cout
Jd gaming thanks
bro i copied that code and my program dosent run
whats the problem
using dev c++ is this program run in dev C++????
CH ABDULLAH hello I don’t know
Thanks for whole code combination, so many errors can debug from your code
you can use logical or operator
if(j == 0 || j == width - 1)
@Lee Ruan can you explain to me how that line of code works. please.
@@uahatoxicboi9801 if j is equal to 0 or j is equal to width minus one then print #.
Rather than making two separate if statements he made 1 statement which will print # when either of those conditions are met.
The || means or. So that if statement will run if either condition is true
Ryan Goods no I meant what is j
@@uahatoxicboi9801 j is the variable he uses in the nested for loop because he can't use i again as it's being used in the outer loop
idk why but when i did this i had an extra "#" out of the box in the first and last line
tysm man my mum is proud of me
You should also congradulate yourself bro you are the one behind the computer
@@Jxhsxn You mean just copying code from a tutorial
@Bima Pramudya Chill it wasn't that harsh. Anyone can copy code from a tutorial, what shows you've learned something is if you can make something yourself.
im learning C# cs
@Nick Right. I know but everyone starts somewhere and do you just expect ihm to just start making games with no knowledge
Really simplified c++ to it's core. I like it
At this point, in order to obtain a real square 20x20 it is necessary
33. if (j>0 && j
?
True, looks way more optimized and less spaghetti-ish
Thanks man I finish the whole game by the end of my virtual classes.Keep up the good work.
For anyone watching this, make sure that in your if statements that you use == to compare.
if (j = 0) is setting j to 0, not checking if it is 0
if (j == 0) checks if j's value is 0.
== its the operator(equal) he is doing like when we take int i;e x=0
Oh thanks dude you saved me :D
if you try to do this in newer versions , to put the constant rand you have to type after #include , #include
Thank you so much, Im having a hard time trying to figure out what am I suppose to do to make rand declared so I can compile and run it
easy to follow, easy to understand, thank you!
I know only code basics like what a variable or constant is; how to make a calculator and stuff like that but watching this and searching up the meanings of the terms really upgraded my knowledge by a whole lot.
So much bullshit in your post.
I like simple tutorials like this. Like++
Thank you for the information you provided for me. Im new to this coding and you displayed your program with eaz of my mind! I really respect what you do,and give you all the props that money cant buy! You presentation is better than many of my professors ever taught me! I will subscribe and will follow you. I would like to pay you for some 1on 1 communication, to help me out personally with my idias in the future! Thank you and be blessed
Loved the contents simple and straight to the point..please uploading !
Hello there :D
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 :D
Thank you! Very clearly explained. You are making good tutorials.
+Martin Ruzhinov why the screen turns off and turns on?
Im use to code in game maker studio, I found your tutorial very nice to a pure c++ introduction. Great Work!
Wow I'm taking up game design and I have a class on c++ and it's my first time ever learning about it. It's a little hard but I understand it. I'll learn as I go.
This will be my project over thanksgiving break
someone still active ?feel so lonely :(
Yeah :)
Yep!
active gang
Me
yep
print('reassure Ruddy dd')
Easy to follow, i am so noob in programming . I understood a lot and you're not boring! :)
Super well explained! Love it
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
pretty cool but i keep getting the errors
In function 'void Setup()':
[Error] 'rand' was not declared in this scope
PLEASE HELP MEH!
Thanks
If #include not worked try #include
Sir, nice one using nested for loops and else-if statement in C++.
Dude your intro is sick.
thx
thx
thx
what is the music ?
thx
Loved the programming tutorial, subscribing to you my man
Finally! A tutorial for windows AND linux.
Youre the man NVitanovic, you deserved that subscription
I’m a biology student never have i ever studied about computers but i’m going to make this
Bro, Just saying but merely copying what someone is doing isn't called programming. It takes years of learning to be a programmer and it isn't easy. Don't feel bad cause my dad used to tell me this when I was small and this is what developed my interest and I took coding as a major.
Regards
Red Bandit
Red Bandit I’m sorry I just wanted to test it out. As you’ve said it takes years of learning and you are absolutely correct i couldn’t even understand this properly.....
Red Bandit And Good Luck with coding!
@@perrypatel79 ur gay
Done sir in Dev cpp 👍
After fixing lots of bugs thank you ❤️
He sounds so depressed 0:27-0:32
TheCuteTimo yeah wtf
*"I've coded for 15 years and all i can code is a simple snake game, is there any point living like this?"*
samuel suuronen lol 😂😂
no u wtf
life of a programmer
Nikola, hvala na tutorijalu!
here is a more readable version of the draw function. It is a little confusing when your syntax is inconsistent like in the video with the missing curly brackets and deleting else.. happy coding!
void draw(){
system("cls");
for (int i = 0; i
How do you get your window to clear and look like it has motion?
I'm trying to build a game of connect 4 and dont want the console window to scroll for every play
i made snake game in C++ too as programming project.
can you please tell me whats compiler are you using please ...I need full name
Proslo je skoro 5 godina ali i dalje odlican video :D
great work and well explanation, thanks ;)
Your code is flickering because of the "gameover" variable not being made true at the end. This makes your code to execute repeatedly thus clearing and printing the map forever!!
obviously the code has to be repeated so you can update the position of the snake
@@SkiNNyPoNNy would the code be better if you create a multidemintional array and print the # on the first and last indexes of the array ?
int array[x][y];
for (int i = 0; i< x; i++){
array[0][ i ] = "#";
array[x][ i ] = "#";
}
for (int i = 0; i< y; i++){
array[0][ i ] = "#";
array[y][ i ] = "#";
}
This really helped me... Now I can right the exact same code without looking or listening!
I`m learning programming for 3 years and I still like "WTF IS THAT MEAN?"
You need to try new things man or get a better teacher
Cool video NV. I didn't know with C++ you could make a very simple game that easily. I assumed you would have over 100 lines of code to start your first very basic game. Also, are you able to make games with C as well as C++? I prefer C++ over C, C++ feels more flexible. At the moment I am taking a break from Kotlin and I am playing around with C++ to try and better understand how the language works and see if I can build a very simple but small game. I am happy I found your channel.
Whats the difference between system(“cls”) and clrscr() ?
From what I could find from a quick search, clrscr() is an old function that is only included with a header file that comes with some old C compiler. Whereas system() is a C/C++ Standard function, meaning it has to be included in every compiler, and "cls" is just the console command to clear the screen.
Apart from that, I think the functions are identical with that as an argument to system().
This video really help me but you have to add "include on the second line
Ayy lmao, pretty good tutorial you know what I'm sayin. But can you do a meme programing tutorial? I need to step up my meme game ASAP.
Thanks dude.
Ps sick snake game bruh
Thanks for all the efforts.. I laugh each time u say We have something not good:)
Hello,
I have a problem.. the programm is just spamming the console with #.
I hope I can get a fast answer.
im having the same problem
had the same problem. I had i++ for one of them, when it was j++
i had the same problem and fixed it by just compiling xD
Which ide are you using guys ?
Eren Gemici c free
I downloaded the visual studio program but when I installed it my video playback shows a black screen. What happened and what do I do??
Unable to start program :( when I start Debugging
@TCP Timeouts Thanks, dude :D
@TCP Timeouts Don´t worry :D I will try it now. Thanks
You should make a tutorial explaining what each tag means, for beginners :)
And what the tag does and how it interacts with other tags ect
+Pafiro There are thousands of tutorial for beginners, here you have something else
Yea I know, just suggesting it most of the tuts I found didnt explain it very well
You have not given enough intro to each line of code to make it understand what each line do.
remind me what's google for again?
Can I increase the speed of the snake to make the game a little bit tougher time by time? Say, you eat 5 fruits and the speed increases...
I'm 1st semester student.I have learned c programing basic and now I'm learning c++,here learning how to make games
When I enter the function "fruitX = rand ()% width;" Tells me the "rand" identifier is undefined and the same as "system" ("cls");"
can u help me ? :)
Andrei same
same
Mine is working fine but someone below had the same problem and they were telling him to put #include ont top, hope it helps (sorry for my english)
ok thx
#include , this will make the "system"(cls); to work.
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
Add these two libraries:
#include
#include
I had the same problem. It helped me.
you can draw it by simple code to draw square :
for(int j = 0 ; j < height ; ++j)
{
for(int i = 0; i < width ;++i)
{
if( i == 0 || i == (width - 1) || j == 0 || j == (height - 1) )
{
cout
Thanks ! This is small and efficient code
I know I'm 11 months late and that this might be a dumb question, but why do people prefer writing "++j" instead of "j++" in a For? j++ seems more natural to me, is anything different if you write it the other way around?
if you write "++j" it will add 1 to j before it counts the value of j and if you write "j++" it will count the value of j then add 1 to it. In for loop it doesnt make that big of a diffrence (i think).
So if you write this:
int a = 0, b = 0;
cout
Oooh, I understand now! Thank you very much, I really appreciate the help!! :D
mine is better :)
#include
using namespace std;
int main(){
int n,m;
cin>>n>>m;
for(int k=0;k
very useful project to learn C++. Thanks!
unreal engine 5!!
I am using Xcode instead of visual studio on my mac and I encountered a problem telling "TERM environment variable not set." Can you please help me sort it out?
I'm so confused 😫
Great video, thank you. Still I tried to follow step by step but the result still looping. Not sure what I am doing wrong
Amazing vídeo!!!!!
Can somebody help me please? Like when i try to run the code ( which is the same from the video) the game is not looking like in the video ( it appears and disappeara continuosly and it doesnt work moving the snake).
Might the problem be the program? Maybe something is not good in my coding program or maybe the problem comes from my pc. ( It happens the same with code blocks and visual studio )
Do you have a sleep function somewhere that makes the redrawing delayed?
instead of adding 2 to width in the loop i made it like this in the if statement:
if (j == 0 || j == width -1)
cout
Well, I'm quitting my first year of studies to pursue computer science - you made me glad I also noticed this unnecessary line m8
It's a pretty good tutorial but I wish you went more in-depth on what you are doing. Anyone who isn't a complete novice might disagree with me though. Can't please them all but I appreciate this regardless.
@Bob Bob Yes, even complete novices get bored with the basics and would like to try something they aren't yet ready to completely understand.
#include
using namespace std;
bool gameOver;
const int width = 20;
const int height = 20;
int x,y,fruitX,fruitY,score;
enum eDirecton {STOP = 0, LEFT , RIGHT , UP , DOWN};
eDirecton dir;
void Setup()
{
gameOver = false;
dir = STOP;
x = width / 2;
y = height /2;
fruitX = rand() % width;
fruitY = rand() % height;
score = 0;
}
void Draw()
{
system("cls");
for (int i=0; i< width+2; i++)
cout
Actually I am doing it on code blocks the error occuring is rand()
"It says that rand() is not declared ." Help me please.
Add to ur code #include "stdlib.h"
Hey, I'm a really beginner in this coding, can u tell me what should I do to get to the coding section??
ЙОР инглиш ис вери бед мен
кала бока мано фала мелиор энтао
ю инглиш ту вери бэд, как и мой
Your English is very bad man.......lol
thank you soooooooooooooooooooooooooooo much for your lesson
I like that you use so simple english because my english skill is very bad but i understood like 99%
+NVitanovic The console is flickering too much.The food and snake head are also not stable.What should I do?
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.
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?
This is the first video I saw of you!
Tutorial is great. How did you get rid of the text cursor? On my computer, it shows up all over the screen.
i am doing this in dev c++ and all i get is constant opening of cmd windows, like they just flash rolling open for me? how can i make em stop?
how did you open this app visual Microsoft
my visual studio says that it doesn't recognize: identifier "end1" is undefined
it's endl not end1
Learn C++, don't just copy code!
@@undefinedchannel9916 how?
Mr. Caveira Learn c++ from the internet lol !!
@@mr.caveira8043 go to RUclips, search C++ tutorial, look for one that has a lot of views
Profit.
:D
Nice. I'm trying to transition from Actionscript 2.0 and people recommended java. But i noticed that C++ could go straight to the compiler and get a better performance.
hi guy, is it possible to do it again but using the language C
You wasn't kidding when you say it "flickers a littler bit"
I'm using visual studio 2010,
I did this - File -> New file -> Visual C++ -> C++ File -> open , and I typed in the code.
But I don't get the Run button (the tiny right-facing triangle you click), its faded out.
HOW DO I RUN THE PROGRAM?
Sir! After compilation the program it shows an error that "Rand was not declared in this scope", sir please guide me.
how do i use the visual studio express thing?
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)
Hey my console is flickering too slow which is causing the bottom left corner to not show up and tips?
What are we supposed to open the project as?
Are we supposed to open it as a Visual c++ Win32 console application?
I mean it won't compile and run my code so I'm trying to figure out the problem.
Okay I fixed it I just had to add: #include "stdafx.h"
To the first line of code.
hi NVitanovic:
What is your background? Are you a software engineer, computer scientist? How many programming language do you know how to used?
does this only work on visual studio because im using dev c++ and it is not running is says there is a error on line 4 & 5