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

  Рет қаралды 2,246,112

NVitanovic

NVitanovic

Күн бұрын

Пікірлер: 1 300
@pR1sooeem
@pR1sooeem 6 жыл бұрын
"So if we run our programm now..... we get something that's..not good...." Bro, i feel you so much
@shaggiel3099
@shaggiel3099 5 жыл бұрын
Yea, this is the only guy I’ve seen who’s used that term, sadly.
@rajahussainabbaxi8940
@rajahussainabbaxi8940 5 жыл бұрын
In snake game part 1 , compiler occur an error that 'rand' was not declared in this scope Please reply me Please, ,
@danielgorokhov3457
@danielgorokhov3457 5 жыл бұрын
@@rajahussainabbaxi8940 dude, send ur code here
@rajahussainabbaxi8940
@rajahussainabbaxi8940 5 жыл бұрын
@@danielgorokhov3457 thanks,, I watch complete code from your comments and also highlight my mistakes,, again thanks for your reply,, It's amazing code 😍
@Tony-lp8hy
@Tony-lp8hy 5 жыл бұрын
Raja Hussain abbaxi do you have #include or . Or did u just use rand and forget its rand()?
@dragonturd21
@dragonturd21 3 жыл бұрын
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
@mattfluffy6954
@mattfluffy6954 3 жыл бұрын
You are a good man, thank you.
@rahilsiddique6950
@rahilsiddique6950 3 жыл бұрын
Legend 🙏
@adnankahvecidogan9155
@adnankahvecidogan9155 3 жыл бұрын
Thanks zaheer. Loved red lotus btw.
@Mario-hq6cl
@Mario-hq6cl 3 жыл бұрын
Thank you!
@CookedChicken1
@CookedChicken1 3 жыл бұрын
wow Thanks
@andtpfack8243
@andtpfack8243 8 жыл бұрын
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 !
@reziik6904
@reziik6904 8 жыл бұрын
Agreed! (Sorry for the necro)
@stranger5891
@stranger5891 7 жыл бұрын
+Andtp Fack congrats
@garycoloman8506
@garycoloman8506 7 жыл бұрын
loser
@scratchbloxunlimited8959
@scratchbloxunlimited8959 7 жыл бұрын
Andtp Fack I
@darkorandjic2574
@darkorandjic2574 7 жыл бұрын
Anders Hansen Learn C++ before watching the video for fucks sake!
@teodortodorov1662
@teodortodorov1662 4 жыл бұрын
My brain: What did you just watch? Me: Programming. My Brain: So, what did you understand? Me: Nothing
@worldshaper1723
@worldshaper1723 4 жыл бұрын
@dark tv Great advice. Brother I wish everyone understood they do not need to understand much in the first day.
@yodagaming3003
@yodagaming3003 4 жыл бұрын
@denisucuuu don't use "using namespace std;". just don't.
@gamesholplays7162
@gamesholplays7162 3 жыл бұрын
dobre
@christianr.5868
@christianr.5868 3 жыл бұрын
@@yodagaming3003 why though?
@cluelessnoob4138
@cluelessnoob4138 8 ай бұрын
​@@yodagaming3003why?
@jeydii5409
@jeydii5409 5 жыл бұрын
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
@bellamycat9800
@bellamycat9800 5 жыл бұрын
Jd gaming thanks
@chabdullah4805
@chabdullah4805 5 жыл бұрын
bro i copied that code and my program dosent run whats the problem
@chabdullah4805
@chabdullah4805 5 жыл бұрын
using dev c++ is this program run in dev C++????
@bellamycat9800
@bellamycat9800 5 жыл бұрын
CH ABDULLAH hello I don’t know
@rajahussainabbaxi8940
@rajahussainabbaxi8940 5 жыл бұрын
Thanks for whole code combination, so many errors can debug from your code
@theencube5379
@theencube5379 9 жыл бұрын
if c++ doesnt recognize rand include this: #include
@Lewis77681
@Lewis77681 4 жыл бұрын
Thanks bro Now i can run it.
@d4rkn3ss13
@d4rkn3ss13 4 жыл бұрын
ty bro but now it dont declare "cout" neither "endl"
@ioanasalaru1675
@ioanasalaru1675 4 жыл бұрын
THE COMMENT I"VE BEEN LOOKING FOR!THANKSSS
@misteriousquestion7426
@misteriousquestion7426 4 жыл бұрын
see u in heaven boy!!
@gregjenkins5258
@gregjenkins5258 4 жыл бұрын
theen cube for pres 2020
@dreamhollow
@dreamhollow 5 жыл бұрын
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!
@АбдуллахАхмид
@АбдуллахАхмид 5 жыл бұрын
do you have videos better than this
@thefrankincense4331
@thefrankincense4331 5 жыл бұрын
We are on the same boat
@unrevealablegaming2912
@unrevealablegaming2912 3 жыл бұрын
same also i think there is gonna be a new person every single year
@kristianuremovic4085
@kristianuremovic4085 3 жыл бұрын
@@unrevealablegaming2912 guess we share the same year :)
@kushal6065
@kushal6065 3 жыл бұрын
@@kristianuremovic4085 yeah guess so
@mr.mowgee2240
@mr.mowgee2240 2 жыл бұрын
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. 🔥
@fortnite-guy202
@fortnite-guy202 Жыл бұрын
Same here
@RazanOraby
@RazanOraby 7 ай бұрын
same here how is it so far
@jatinnegi6363
@jatinnegi6363 6 жыл бұрын
you can use logical or operator if(j == 0 || j == width - 1)
@uahatoxicboi9801
@uahatoxicboi9801 4 жыл бұрын
@Lee Ruan can you explain to me how that line of code works. please.
@ryangoods7949
@ryangoods7949 4 жыл бұрын
@@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
@uahatoxicboi9801
@uahatoxicboi9801 4 жыл бұрын
Ryan Goods no I meant what is j
@ryangoods7949
@ryangoods7949 4 жыл бұрын
@@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
@iyad3753
@iyad3753 4 жыл бұрын
idk why but when i did this i had an extra "#" out of the box in the first and last line
@cgme9535
@cgme9535 3 жыл бұрын
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.
@rexmagotia
@rexmagotia 7 жыл бұрын
Adding 2 units in the for loops to make the first and the last line of the map could be replaced with the
@JOAGOSTINI
@JOAGOSTINI 6 жыл бұрын
At this point, in order to obtain a real square 20x20 it is necessary 33. if (j>0 && j
@renaldiatma7828
@renaldiatma7828 4 жыл бұрын
?
@WorstAbaYT
@WorstAbaYT Жыл бұрын
True, looks way more optimized and less spaghetti-ish
@i_inject_crayons9473
@i_inject_crayons9473 3 жыл бұрын
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
@redwar7253
@redwar7253 Жыл бұрын
The difference between learning to code and learning to make a program
@PaulBlxck
@PaulBlxck 8 жыл бұрын
This is going to be my first year project (and my first ever game) hopefully it works out. Thanks!
@loveuandrew897
@loveuandrew897 5 жыл бұрын
Paul SZ lmao
@quyngo1999
@quyngo1999 5 жыл бұрын
Did it?
@chrissmith1152
@chrissmith1152 5 жыл бұрын
me too
@PaulBlxck
@PaulBlxck 4 жыл бұрын
@@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.
@PaulBlxck
@PaulBlxck 4 жыл бұрын
@@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.
@greediusgeek
@greediusgeek 8 жыл бұрын
Thanks for the tutorial bro,it motivated me to learn more about C++
@yaroslavazxM
@yaroslavazxM 4 жыл бұрын
Thanks man I finish the whole game by the end of my virtual classes.Keep up the good work.
@ridhomblr
@ridhomblr 5 жыл бұрын
tysm man my mum is proud of me
@Jxhsxn
@Jxhsxn 4 жыл бұрын
You should also congradulate yourself bro you are the one behind the computer
@Nick-lx4fo
@Nick-lx4fo 4 жыл бұрын
@@Jxhsxn You mean just copying code from a tutorial
@Nick-lx4fo
@Nick-lx4fo 4 жыл бұрын
@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.
@mikethegamedev
@mikethegamedev 4 жыл бұрын
im learning C# cs
@jackeezz3002
@jackeezz3002 4 жыл бұрын
@Nick Right. I know but everyone starts somewhere and do you just expect ihm to just start making games with no knowledge
@polygonerror
@polygonerror 7 жыл бұрын
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.
@mrcorparate
@mrcorparate 7 жыл бұрын
== its the operator(equal) he is doing like when we take int i;e x=0
@JorisNonnast
@JorisNonnast 6 жыл бұрын
Oh thanks dude you saved me :D
@kacperozieblowski3809
@kacperozieblowski3809 7 жыл бұрын
Really simplified c++ to it's core. I like it
@milkyfilsen7972
@milkyfilsen7972 3 жыл бұрын
if you try to do this in newer versions , to put the constant rand you have to type after #include , #include
@JozzJavier
@JozzJavier 2 жыл бұрын
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
@Tiogar60
@Tiogar60 5 жыл бұрын
Super well explained! Love it
@Noumanrana-d8z
@Noumanrana-d8z Жыл бұрын
system("CLS") command is not working for me. even after putting header file it still didn,t work deos anyone know how to slove this problem.
@richardp2545
@richardp2545 8 ай бұрын
following
@HassanIQ777
@HassanIQ777 8 ай бұрын
Windows: system("cls"); Linux + Mobiles: system("clear");
@breeze2440
@breeze2440 4 жыл бұрын
Loved the contents simple and straight to the point..please uploading !
@brianscalabrine2225
@brianscalabrine2225 4 жыл бұрын
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.
@atlantic_love
@atlantic_love 3 жыл бұрын
So much bullshit in your post.
@drcvagos-iu
@drcvagos-iu 9 жыл бұрын
easy to follow, easy to understand, thank you!
@dorijan3920
@dorijan3920 4 жыл бұрын
Proslo je skoro 5 godina ali i dalje odlican video :D
@martinruzhinov3348
@martinruzhinov3348 9 жыл бұрын
Thank you! Very clearly explained. You are making good tutorials.
@abdelfattehbenafia7104
@abdelfattehbenafia7104 8 жыл бұрын
+Martin Ruzhinov why the screen turns off and turns on?
@logomoniclearning6680
@logomoniclearning6680 7 жыл бұрын
Youre the man NVitanovic, you deserved that subscription
@cloverplays1706
@cloverplays1706 5 жыл бұрын
I’m a biology student never have i ever studied about computers but i’m going to make this
@perrypatel79
@perrypatel79 5 жыл бұрын
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
@cloverplays1706
@cloverplays1706 5 жыл бұрын
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.....
@cloverplays1706
@cloverplays1706 5 жыл бұрын
Red Bandit And Good Luck with coding!
@AJ8800
@AJ8800 5 жыл бұрын
@@perrypatel79 ur gay
@gonzalorosario1278
@gonzalorosario1278 4 жыл бұрын
Im use to code in game maker studio, I found your tutorial very nice to a pure c++ introduction. Great Work!
@DanielZawadzki32
@DanielZawadzki32 5 жыл бұрын
I like simple tutorials like this. Like++
@everything_programming7096
@everything_programming7096 4 жыл бұрын
Loved the programming tutorial, subscribing to you my man
@181Ravikiran
@181Ravikiran 8 жыл бұрын
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
@gameShu_Yaksha
@gameShu_Yaksha 7 жыл бұрын
Thanks ! This is small and efficient code
@versache8247
@versache8247 7 жыл бұрын
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?
@ishant0wn
@ishant0wn 7 жыл бұрын
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
@versache8247
@versache8247 7 жыл бұрын
Oooh, I understand now! Thank you very much, I really appreciate the help!! :D
@Player-ub9tg
@Player-ub9tg 7 жыл бұрын
mine is better :) #include using namespace std; int main(){ int n,m; cin>>n>>m; for(int k=0;k
@ruddydd4085
@ruddydd4085 4 жыл бұрын
someone still active ?feel so lonely :(
@sirfmgamer5655
@sirfmgamer5655 4 жыл бұрын
Yeah :)
@presauced
@presauced 4 жыл бұрын
Yep!
@HAAAAAAAAHHHHHH
@HAAAAAAAAHHHHHH 4 жыл бұрын
active gang
@dmitryhetman1509
@dmitryhetman1509 4 жыл бұрын
Me
@osofinoso1507
@osofinoso1507 4 жыл бұрын
yep print('reassure Ruddy dd')
@newmagicfilms
@newmagicfilms 8 жыл бұрын
Easy to follow, i am so noob in programming . I understood a lot and you're not boring! :)
@Flyingsandwiches-nr1zc
@Flyingsandwiches-nr1zc 5 жыл бұрын
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.
@juliushouston3640
@juliushouston3640 5 жыл бұрын
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
@thecutetimo
@thecutetimo 7 жыл бұрын
He sounds so depressed 0:27-0:32
@andrewabisarkis1311
@andrewabisarkis1311 6 жыл бұрын
TheCuteTimo yeah wtf
@samuelsuuronen4979
@samuelsuuronen4979 6 жыл бұрын
*"I've coded for 15 years and all i can code is a simple snake game, is there any point living like this?"*
@ericajanesantos56
@ericajanesantos56 6 жыл бұрын
samuel suuronen lol 😂😂
@ARetardWhoNeeds1000Subscribers
@ARetardWhoNeeds1000Subscribers 6 жыл бұрын
no u wtf
@_denis_020_3
@_denis_020_3 6 жыл бұрын
life of a programmer
@FinnishArmy
@FinnishArmy 3 жыл бұрын
This will be my project over thanksgiving break
@Noble_1776
@Noble_1776 7 жыл бұрын
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
@grilledpikachu
@grilledpikachu 2 жыл бұрын
very useful project to learn C++. Thanks!
@greenheart5334
@greenheart5334 6 жыл бұрын
i made snake game in C++ too as programming project.
@safarekhawab3376
@safarekhawab3376 4 жыл бұрын
can you please tell me whats compiler are you using please ...I need full name
@YØK-b3x
@YØK-b3x 2 жыл бұрын
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
@hademvids
@hademvids 8 жыл бұрын
pretty cool but i keep getting the errors In function 'void Setup()': [Error] 'rand' was not declared in this scope PLEASE HELP MEH!
@hademvids
@hademvids 8 жыл бұрын
Thanks
@فيشكر
@فيشكر 7 жыл бұрын
If #include not worked try #include
@jithinpaulson
@jithinpaulson 4 жыл бұрын
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
@SobhyShehata
@SobhyShehata 7 жыл бұрын
great work and well explanation, thanks ;)
@nadaatef3861
@nadaatef3861 2 жыл бұрын
Thanks for all the efforts.. I laugh each time u say We have something not good:)
@danji9485
@danji9485 8 жыл бұрын
Finally! A tutorial for windows AND linux.
@DarisYT
@DarisYT 5 жыл бұрын
Nikola, hvala na tutorijalu!
@thebeluvdtrex
@thebeluvdtrex 8 жыл бұрын
Dude your intro is sick.
@stranger5891
@stranger5891 7 жыл бұрын
thx
@juubes5557
@juubes5557 7 жыл бұрын
thx
@ayayayaya6645
@ayayayaya6645 7 жыл бұрын
thx
@tunglam7187
@tunglam7187 7 жыл бұрын
what is the music ?
@giwahdavalos4699
@giwahdavalos4699 7 жыл бұрын
thx
@aslanferzana6201
@aslanferzana6201 3 жыл бұрын
This video really help me but you have to add "include on the second line
@rAYONSINHAlese9485
@rAYONSINHAlese9485 3 жыл бұрын
Sir, nice one using nested for loops and else-if statement in C++.
@denzellupheng7063
@denzellupheng7063 5 жыл бұрын
Whats the difference between system(“cls”) and clrscr() ?
@user-bo5vr1ib6i
@user-bo5vr1ib6i 4 жыл бұрын
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().
@mr.caveira8043
@mr.caveira8043 4 жыл бұрын
my visual studio says that it doesn't recognize: identifier "end1" is undefined
@leonida-sabiri4716
@leonida-sabiri4716 4 жыл бұрын
it's endl not end1
@undefinedchannel9916
@undefinedchannel9916 4 жыл бұрын
Learn C++, don't just copy code!
@mr.caveira8043
@mr.caveira8043 4 жыл бұрын
@@undefinedchannel9916 how?
@leonida-sabiri4716
@leonida-sabiri4716 4 жыл бұрын
Mr. Caveira Learn c++ from the internet lol !!
@undefinedchannel9916
@undefinedchannel9916 4 жыл бұрын
@@mr.caveira8043 go to KZbin, search C++ tutorial, look for one that has a lot of views Profit. :D
@teodortodorov1662
@teodortodorov1662 4 жыл бұрын
I`m learning programming for 3 years and I still like "WTF IS THAT MEAN?"
@brianscalabrine2225
@brianscalabrine2225 4 жыл бұрын
You need to try new things man or get a better teacher
@informalpivots7673
@informalpivots7673 4 жыл бұрын
Done sir in Dev cpp 👍 After fixing lots of bugs thank you ❤️
@truthvader5727
@truthvader5727 6 жыл бұрын
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
@SkiNNyPoNNy 6 жыл бұрын
obviously the code has to be repeated so you can update the position of the snake
@MrThienprowinn
@MrThienprowinn 6 жыл бұрын
@@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 ] = "#"; }
@retrogamingbros8164
@retrogamingbros8164 7 жыл бұрын
This really helped me... Now I can right the exact same code without looking or listening!
@detomatorcz910
@detomatorcz910 8 жыл бұрын
Unable to start program :( when I start Debugging
@detomatorcz910
@detomatorcz910 4 жыл бұрын
@TCP Timeouts Thanks, dude :D
@detomatorcz910
@detomatorcz910 4 жыл бұрын
@TCP Timeouts Don´t worry :D I will try it now. Thanks
@Parth-gx1nw
@Parth-gx1nw 3 жыл бұрын
I'm 1st semester student.I have learned c programing basic and now I'm learning c++,here learning how to make games
@Minecaftundmehr2
@Minecaftundmehr2 8 жыл бұрын
Hello, I have a problem.. the programm is just spamming the console with #. I hope I can get a fast answer.
@kanden6442
@kanden6442 8 жыл бұрын
im having the same problem
@Gerpar_
@Gerpar_ 8 жыл бұрын
had the same problem. I had i++ for one of them, when it was j++
@frankakn_7448
@frankakn_7448 8 жыл бұрын
i had the same problem and fixed it by just compiling xD
@er3n-ai
@er3n-ai 7 жыл бұрын
Which ide are you using guys ?
@unpluggedcovers1258
@unpluggedcovers1258 7 жыл бұрын
Eren Gemici c free
@0_-
@0_- 4 жыл бұрын
This is the first video I saw of you!
@Andrei-mi9zn
@Andrei-mi9zn 7 жыл бұрын
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 ? :)
@thunderstormgaming9099
@thunderstormgaming9099 7 жыл бұрын
Andrei same
@qasem9549
@qasem9549 7 жыл бұрын
same
@sendim000
@sendim000 7 жыл бұрын
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)
@qasem9549
@qasem9549 7 жыл бұрын
ok thx
@romulodurante2822
@romulodurante2822 7 жыл бұрын
#include , this will make the "system"(cls); to work.
@yousefsuzuki2436
@yousefsuzuki2436 2 жыл бұрын
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
@hriankovacsolovy7795
@hriankovacsolovy7795 2 жыл бұрын
Add these two libraries: #include #include I had the same problem. It helped me.
@johnnyrod328
@johnnyrod328 7 жыл бұрын
#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
@damm_coder4550
@damm_coder4550 5 жыл бұрын
Actually I am doing it on code blocks the error occuring is rand() "It says that rand() is not declared ." Help me please.
@arturminiput7587
@arturminiput7587 4 жыл бұрын
Add to ur code #include "stdlib.h"
@akielsteewart8577
@akielsteewart8577 3 ай бұрын
9:21 Confused. I'm probably the one missing something but why didn't he say if (j==0 || j==width -1) then print a #, else print a space?
@mostafaebeed9749
@mostafaebeed9749 5 жыл бұрын
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
@krzysztofmatuszek
@krzysztofmatuszek 5 жыл бұрын
Well, I'm quitting my first year of studies to pursue computer science - you made me glad I also noticed this unnecessary line m8
@Cacowninja
@Cacowninja 6 жыл бұрын
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.
@Cacowninja
@Cacowninja 6 жыл бұрын
Okay I fixed it I just had to add: #include "stdafx.h" To the first line of code.
@arcanerstudios
@arcanerstudios 7 жыл бұрын
You have not given enough intro to each line of code to make it understand what each line do.
@kumakanai
@kumakanai 6 жыл бұрын
remind me what's google for again?
@quickscopesheep5994
@quickscopesheep5994 4 жыл бұрын
wanted to learn c++ and game dev using it really great tutorial helped aloat
@KhizarShahalTechnical
@KhizarShahalTechnical 4 жыл бұрын
C++ Advanced Projects kzbin.info/aero/PL2kfJOEQUtTOErhdEKiYFKmZIdFIIeLG9
@TheLeontheking
@TheLeontheking 6 жыл бұрын
unreal engine 5!!
@georgiastefan2670
@georgiastefan2670 5 жыл бұрын
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 )
@zanomeme8041
@zanomeme8041 5 жыл бұрын
Do you have a sleep function somewhere that makes the redrawing delayed?
@MJ-gs4co
@MJ-gs4co 6 жыл бұрын
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
@snowzZzZz
@snowzZzZz 4 жыл бұрын
10:23 the far right wall being +1 from the rest is that because on the first iteration it prints the blank space because you removed the else?
@KhizarShahalTechnical
@KhizarShahalTechnical 4 жыл бұрын
C++ Advanced Projects kzbin.info/aero/PL2kfJOEQUtTOErhdEKiYFKmZIdFIIeLG9
@TheDrumergod
@TheDrumergod 9 жыл бұрын
Amazing vídeo!!!!!
@Mrkevi123
@Mrkevi123 8 жыл бұрын
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
@elementalslap619
@elementalslap619 9 жыл бұрын
I'm so confused 😫
@pafiro
@pafiro 7 жыл бұрын
You should make a tutorial explaining what each tag means, for beginners :)
@pafiro
@pafiro 7 жыл бұрын
And what the tag does and how it interacts with other tags ect
@AK48PL
@AK48PL 7 жыл бұрын
+Pafiro There are thousands of tutorial for beginners, here you have something else
@pafiro
@pafiro 7 жыл бұрын
Yea I know, just suggesting it most of the tuts I found didnt explain it very well
@andrew-iverson
@andrew-iverson 6 жыл бұрын
ЙОР инглиш ис вери бед мен
@MichelWTH
@MichelWTH 6 жыл бұрын
кала бока мано фала мелиор энтао
@zhizhail4711
@zhizhail4711 5 жыл бұрын
ю инглиш ту вери бэд, как и мой
@a.rhythm9702
@a.rhythm9702 4 жыл бұрын
Your English is very bad man.......lol
@HerShe_
@HerShe_ 6 жыл бұрын
This is so cool, can't wait to try this
@m4rt_
@m4rt_ 4 жыл бұрын
9:00 why dont u use the one liner instead of the if else: string wall ( j == 0 ) ? "#" : " "; cout
@agnishabhattacharjee330
@agnishabhattacharjee330 4 жыл бұрын
If you get error for rand(), try adding the header file #include
@tokugeeky2931
@tokugeeky2931 Жыл бұрын
Great video, thank you. Still I tried to follow step by step but the result still looping. Not sure what I am doing wrong
@LetsNotBeHasty
@LetsNotBeHasty 9 жыл бұрын
great work , was really helpful
@azurekeenanlightning
@azurekeenanlightning 4 жыл бұрын
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??
@ReleaseTopic87
@ReleaseTopic87 5 жыл бұрын
Hey, I'm a really beginner in this coding, can u tell me what should I do to get to the coding section??
@juneshgautam8655
@juneshgautam8655 3 жыл бұрын
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?
@prodanalexandru5323
@prodanalexandru5323 9 жыл бұрын
Very well explained!!!Thanks !
@bartoszgowacki3086
@bartoszgowacki3086 5 жыл бұрын
I like that you use so simple english because my english skill is very bad but i understood like 99%
@Entropy3ko
@Entropy3ko 8 жыл бұрын
Wait at 10:11 it's like writing: if(j == 0) cout
@wimharris-ryden3234
@wimharris-ryden3234 4 жыл бұрын
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)
@scribblenauts11
@scribblenauts11 9 жыл бұрын
Hey my console is flickering too slow which is causing the bottom left corner to not show up and tips?
@jctagaming9774
@jctagaming9774 4 жыл бұрын
hi i have a question if i wanted to add color to the snake how would i do that...
@blazefallgaming5054
@blazefallgaming5054 9 жыл бұрын
if you wanna know what he's using its in the description
@jonsnow9246
@jonsnow9246 8 жыл бұрын
+NVitanovic The console is flickering too much.The food and snake head are also not stable.What should I do?
@firestoney1842
@firestoney1842 6 жыл бұрын
Good and understandable tutorial!
@filipkulka4979
@filipkulka4979 2 жыл бұрын
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?
@mostafasamir9472
@mostafasamir9472 8 жыл бұрын
good job it was very useful
@johnsnow5337
@johnsnow5337 5 жыл бұрын
In the loop you can write: if (j == 0 || j == width - 1 || i == 0 || i == height - 1) cout
@sid2399
@sid2399 6 жыл бұрын
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...
C++ Tutorial 18 - Simple Snake Game (Part 2)
12:24
NVitanovic
Рет қаралды 753 М.
I made the same game in Assembly, C and C++
4:20
Nathan Baggs
Рет қаралды 839 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
C++ TIC TAC TOE game for beginners ⭕
19:09
Bro Code
Рет қаралды 42 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 632 М.
Making a Game With C++ and SDL2
8:14
PolyMars
Рет қаралды 1,7 МЛН
How to actually make games in C++ from 0 experience!
5:23
Low Level Game Dev
Рет қаралды 19 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,3 МЛН
x86 Assembly: Hello World!
14:33
John Hammond
Рет қаралды 1,4 МЛН
How to Win Snake: The UNKILLABLE Snake AI
17:05
AlphaPhoenix
Рет қаралды 2,2 МЛН