I love that you left the problem solving part in when there's a error. Makes the vid feel more relatable.
@cgme95353 жыл бұрын
yep
@thesun___2 жыл бұрын
yep
@ryanfredericks44034 ай бұрын
yep
@markypoo51524 жыл бұрын
I'm learning c++ right now and found this and its honestly one of the coolest things I've ever seen
@forresearchpurposes78533 жыл бұрын
if ur fruit is not random generating try this: add #include in header in main() before setup(); add srand(time(NULL)); The rand() function does not generate a truly random number; it actually returns the next pseudo-random value in a sequence of values ranging from 0 to RAND_MAX. You can change the starting point in that sequence using srand().
@TheDorkol53 жыл бұрын
What about my fruit not spawning after eating it 3 times. I checked the x,y and their good. Why noshow?
@bars90393 жыл бұрын
thanks man
@jonahbutler90792 жыл бұрын
mvp
@brhiandavila6987 Жыл бұрын
You are a great help, thank you
@jamesbalajan38508 жыл бұрын
When he was having trouble with the logic I was screaming at the computer you put the decrement/increment under the break statement.
@scottmyron94537 жыл бұрын
When i wrote my code, i didnt even realize he had done that, i just threw them before the break statement and was wondering, wait why is he having "Oh no he did it again".
@mattshu7 жыл бұрын
I WAS SCREAMING TOO
@zelalemtenaw86607 жыл бұрын
Me too.
@sudharsanbalaji56337 жыл бұрын
me 2
@josephsvec54787 жыл бұрын
Me too, but we all make mistakes.
@reezuleanu16767 жыл бұрын
Definetely I've learned a thing or two about coding just from the first video. Really glad you explain what each line of code does.
@lalo246818 жыл бұрын
If anybody else runs into the issue where it goes up and down faster than it goes left and right try this: in the main() put this if (dir == LEFT || dir == RIGHT) { Sleep(5); } Sleep(100); if (dir == UP || dir == DOWN) { Sleep(60); } This should improve the snake movement and make the walls spazz out less
@AndyU967 жыл бұрын
Won't 'Sleep()' make the game less responsive?
@pialdas24517 жыл бұрын
I put the Sleep function after Draw() in main(), not after Input()
@user-ot6or1ze1y3 жыл бұрын
sleep was not declared in this scope
@sakshamchaturvedi3 жыл бұрын
@@user-ot6or1ze1y add #include header file at the top of your program
@RyuuTenno3 жыл бұрын
this is a life saver. My pc is *way* too powerful for this XD
@simplyincorrigible77085 жыл бұрын
if you dont want the game to TERMINATE on screen edge, use this to make the snake 0 appear on the opposite side. if (x > width) x = x - width; if (x < 0) x = x + width; if (y > height) y = y - height; if ( y < 0) y = y + height;
@hellomynameisorange28609 жыл бұрын
Thanks for making these tutorials! I've learned quite a lot about C++. Once again, thank you.
@worldshaper17234 жыл бұрын
Hey brother are amazing at programming ?
@dogtooth_gg8 жыл бұрын
Note: I have tried working this in Dev C++, if you're having problems please put #include and #include
@NVitanovic8 жыл бұрын
Thanks for the contribution!
@snowangel79807 жыл бұрын
did you figure out how to define the case labels? Mine keeps coming up with the errors "break statement not within loop or switch" and "case label "a [and all the other letters] " not within a switch statement"
@5x9x4 жыл бұрын
If your snake goes too fast try this: #include int main() Setup(); while(!gameOver){ Draw(); Input(); Logic(); Sleep(40); } return 0;} } Also the fruit randomization is NOT random.
@sanidhyas3s3 жыл бұрын
I added an input from user to take the difficulty and then set the Sleep(100-input) as input increases the user will get lesser time.
@memoalada4 жыл бұрын
You can add: std::srand(std::time(nullptr)); before using rand() that's will change the random number according to your real time on pc while runtime that's will change the Fruit position every time you run the game :D but don't forget to write #include
@IamNotBored6 жыл бұрын
for(int i = 0; i < width; i++) i have learnt so much
@jaydon.28333 жыл бұрын
Congrats on making a limited loop! I also love this tutorial
@ravenrepairco.78855 жыл бұрын
Thank you so much for this tutorial! Listening to your explanations about each line really helped me with the basics of C++. I do have one critique, though. You mention a lot of Unix alternative commands for certain lines, but unfortunately the entire input code isn't at all Unix-compatible due to requiring conio.h for _kbhit and _getch (although _getch can be easily worked around by using ncurses.h instead of conio.h and replacing "_getch" with "_getchar", whereas _kbhit requires an entire rework of certain parts of the code, which isn't a simple task to a novice programmer, albeit there are quite a few posts about people working around similar issues online.). You might want to list that the finished product as you explain it is only compatible with Windows and DOS-based systems! Regardless though, a really well-made tutorial, even when you made mistakes in the video and had to stop and think for a second, it felt very real and genuine and helps us novices feel less bad about making mistakes!
@sugar83545 жыл бұрын
Hello there!! We noticed exactly what you noticed too. We are trying to make a snake game on linux and have a problem coding the keys. Could you help us in some way please?
@daserstereichen8 жыл бұрын
I love the intro music! Thanks for the tutorials :D
@funnifurrytechgirl4 жыл бұрын
even as a complete newbie i put the command above the break lol, but great tutorial, it was really helpful and educational!
@hustler2123 жыл бұрын
☁️9
@samikshapatel43374 жыл бұрын
4:39 is the logic spot
@artdrawpictures32668 жыл бұрын
+NVitanovic how can i fix that flickering of the # Icons?
@foquro6684 жыл бұрын
I don't know but mine isn't flickering. Sry that I have no solution for you : (
@foquro6684 жыл бұрын
I got it working! I just reversed fruitX and fruitY: if (x == fruitY && y == fruitX) { fruitX = rand() % width; fruitY = rand() % height; score+=10; } I know usually this isn't good but it works!
@vir77962 жыл бұрын
I honestly love this tutorial so far. very nice, simple, and easy to understand. I'm personally using ncurses and cstdlib instead of conio since isn't available on macOS and Linux. There's not much difference in its implementation though, so it works out fine enough.
@MissRhea195 жыл бұрын
Hi sir, im having trouble with the movement of the snake its quite fast i cant even handle it. Is it possible to adjust the speed of the snake?
@stephenmatthew38815 жыл бұрын
Use the sleep function. sleep(1000);
@GilFavor1015 жыл бұрын
For windows, try __sleep()_ , example: if (dir == LEFT || dir == RIGHT) _ sleep(40); if (dir == UP || dir == DOWN) _ sleep(60); I put this in the Draw function, works okay.
@MrDeeb005 жыл бұрын
@@GilFavor101 thx :)
@sonifasharmin36094 жыл бұрын
@@stephenmatthew3881 I find 150 works best.
@foquro6684 жыл бұрын
If you're using Linux and sleep() is too slow use usleep(). sleep() is using seconds and usleep is using microseconds.
@joshstadtmueller67655 жыл бұрын
fatal error: conio.h: No such file or directory #include is anyone else running into this problem would really appreciate some help, thanks
@greenjd37005 жыл бұрын
If you are still having this problem you may have to reinstall visual studio or whatever you are using.
@justcause73505 жыл бұрын
Do not use conio.h in these applications. It is not recommended.
@funnifurrytechgirl4 жыл бұрын
works fine for me, im using "TDM-GCC 4.9.2 64-bit release" for my compiler
@devashish_manna7 жыл бұрын
I found two loop holes. 1) fruit should not generate where your tail is 2)if you are going left you can't go right .(applied to all directions) I actually solved them . Thanks for this tutorial. It helped
@AndyU967 жыл бұрын
Even if fruit generates where the tail is, that won't make too much of a problem as long as the fruit doesn't get eaten by the tail, I think
@jayseagal36813 жыл бұрын
is there a way to take keypressed input without using #include or #include
@Roast_Pollo5 ай бұрын
#include and #include are what make those things work
@roydaher66715 жыл бұрын
i'm using visual studio 2019 they're telling me that the sleep function has been replaced by another version and its undefined . could somebody help me out please?
@harshjain42564 жыл бұрын
Use delay func
@privatepancake27604 жыл бұрын
you could also put #include
@amirkia23784 жыл бұрын
dont put std:: behind it and add #include
@nurhusna14074 жыл бұрын
So glad you show that you make mistake and how to fix it. A very good way to learn. Thank you!
@OmK-st2kk5 жыл бұрын
Hi, Nvitanovic. Your tutorial is great and I used it but I have a problem. First of all the program flickers too much that I can't see anything. Second of all my snakes head moves so fast and vanishes after a second and I can't catch the fruits and the game instantly terminates. I was hoping if you or anyone could help me.(BTW will the sleep thing help any of those problems?)
@geneticallygamer2 жыл бұрын
If you guys want it to only move once every keyboard press/hit then use else{ dir = STOP;} after void input if statement
@rhodaappiah8120 Жыл бұрын
Will it be after the } sign?
@boy65303 жыл бұрын
I will come back I hope a year from now I can execute this snake game easily so future me hello I hope you made it I believe in you by the way this is my first semester in Uni( IT )
@gonzalorosario12784 жыл бұрын
I eat my nails seeying that you overlook the break; over the argument that you wanna execute in the switch argument. Great video!!!
@kaimynelis5 жыл бұрын
cool tutorial, as long as it doesn't hit conio.h library which is windows specific, and in linux there is no such stuff. as long as I researched. there is ncurses.h library which should do the work, but it may or may not conflict with iostream library. probably would be nice to rewrite this interesting tutorial in portable manner, where correct libraries would be used depending on machine.
@simi82204 жыл бұрын
my score part and logic and input is completely same as in the video but when i pass over F my score doesnt increase and the F doesnt teleport to another spot randomly. help?
@gabrielmendesturyguimaraes8253 Жыл бұрын
Bit late, but you probably inverted the i and j when printing ur fruit in the Draw function
@NikiGz8 жыл бұрын
Nice tutorial, but i have a small problem. My snake moves too fast, what can i do to make it go slower?
@kamahlarcherfair20618 жыл бұрын
the int main() go to the sleep and increase the sleep number the parenthesis. Example: Current - Sleep (10); Change to - Sleep (100); whatever number is your choosing.
@NikiGz8 жыл бұрын
thanks, it works :D
@kamahlarcherfair20618 жыл бұрын
+Tacticz Spain you are welcome.
@deadyanothaikiropool1chait7138 жыл бұрын
What library?
@Seboolek8 жыл бұрын
#include
@omkarpatil20948 жыл бұрын
snake wont move... seems to be a problem with enum, and when i typed switch(dir), visual studio did not directly add the parameters!
@manoj_kumar_sarkar6 жыл бұрын
use eDirecton
@aronkafexhiu30684 жыл бұрын
same problem,did u solve it
@rishika65253 жыл бұрын
The enum dir when using in switch case is showing ambiguity. What to do ?
@rizpect014 ай бұрын
You are amazing MAN!!
@naveenkr.9043 жыл бұрын
how the snake head is moving continuously if there is only one time (x++) increment statement??
@S_whoelse3 жыл бұрын
loop function, you have the input in the main function and its always playing when the setup is active. So when you loop it into the main function it does the X++ statement infinitely.
@veracruz45934 жыл бұрын
Trying to replace conio.h was annoying -- use ncurses. You can define your own kbhit function pretty easily. If you need a hand here's my snake game: github.com/vvveracruz/snake-game
@akankshapawar7378 Жыл бұрын
Thanks!
@sawyeranderson4166 Жыл бұрын
Thanks, I've spent an embarrassing amount of time on this. :)
@w1nt3rolymp1cs315 күн бұрын
thanks im stuck here rn
@monty74746 жыл бұрын
hi, how do you get the drawings to stop flickering?
@sachinmalik58375 жыл бұрын
see topic namely double buffering in c graphics . he is not using graphics .h thats why there is this flickering
@sampathkumartallapally56914 жыл бұрын
if it stops flickering , we will see all heads or 0
@artfulization8 жыл бұрын
Can you explain please. How can a point ( O ) go up, when you decrease Y value? I dont get that logic ... And how can it go down when you increase it?
@carterschmalzle12458 жыл бұрын
In this case the origin is in the top left corner. Y is the distance from a point to the origin, so the larger Y is, the further it will be from the top of the screen. Basically Y is the opposite of what it would be on a standard coordinate plane.
@robertoreal93718 жыл бұрын
Ok, thank you very much!! One last question, do you think that will be possible to put random walls in the middle of the square in order to make it more difficult?
@johanlindstrom95038 жыл бұрын
When I try to compile and build I get error: 'kbhit was not declared in this scope exact same error on the getch. Im building in CodeBlocks on Linux. any suggestions for a fix?
@dizhong83688 жыл бұрын
Hi, I wonder how to make the snake moves slower? It is movin too fast for now.
@fastoon47898 жыл бұрын
add Sleep(put ur number here) the time is in miliseconds so 1000 is 1 sec 10000 is 10 sec etc...
@dondare73344 жыл бұрын
Why isnt this guy uploading anymore,? Does anybody know?
@NVitanovic4 жыл бұрын
Will do :), I've been planning for quite some time a new game tutorial for C++ that will teach you how to use Polymorphism by making a simple game. After that I will probably start a new series on C# or Python. Have a happy New Year!
@dondare73344 жыл бұрын
@@NVitanovic You too, wasn't really expecting a response. But I really like your videos! Your tutorials are great! Can you do sukudo or minesweeper?
@ctonew61553 жыл бұрын
I am learning C++ and you made it fun and intresting. I also love the comments #include helped in slowing the snake and #include to make the fruit appear randomly. Thanks.
@hustler2123 жыл бұрын
This helped
@qutabshah28892 жыл бұрын
Thank you and also show us the hole program when it is don
@drinkurtishi87356 жыл бұрын
How to add graphics to this?
@noormuhammad59235 жыл бұрын
use a game engine
@daivaanshusoanii61294 жыл бұрын
How to make one
@Sake6793 жыл бұрын
@@daivaanshusoanii6129 Code your own game engine
@bishwajeetsharma34987 жыл бұрын
what is the need for enumerator why can't we directly use switch(getch()){case 'a': x++; break;........}for change of direction
@CarlWithAKay9 жыл бұрын
5:40 That moment when mine works great and his is broken XD 20 min of programming and I AM THE MASTER!
@MrDeeb005 жыл бұрын
lol
@harisadam99292 жыл бұрын
i can't use _kbhit() and _getch() in linux
@clashes4d345 жыл бұрын
hi im coding this on linux debian and the conio.h is only supported for ms compilers Using gcc compiler is there an alternative???? THX : )
@clashes4d345 жыл бұрын
FOUND IT! it´s ncourses.h import it in linux with the command: debian: sudo apt-get install libncurses5-dev libncursesw5-dev ubuntu: sudo yum install ncurses-devel ncurses hope i could help you a little bit!!! :) (insert lennyface)
@pponcho82455 жыл бұрын
How come my Visual Studio didn't populate the cases like it did on him on 4:53 ??
@JessePatrick-zc8ng3 жыл бұрын
You hit tab when the little windows appear
@sanghuncho49898 жыл бұрын
I am using eclipse C++ and conio.h doesnt work and kbhit() also fails to work.. so would be great if there is a solution for this
@steliostb31206 жыл бұрын
I see the error
@austin-m8r-w6d6 жыл бұрын
I know it's late but I'm pretty sure conio.h is windows only so if you are on mac or linux it will not work
@sutterseba5 жыл бұрын
@@austin-m8r-w6d Alternative?
@austin-m8r-w6d5 жыл бұрын
@@sutterseba I believe ncurses is the best bet.
@kayang048 жыл бұрын
8:52 when i ran the game with that line of code, it closes immideatly as it opens
@kimchist29165 жыл бұрын
this the lesson i was lookin for. thx brah
@Muck-qy2oo7 жыл бұрын
I don 't have conio.h as I use Linux Mint. Is there an alternative?
@adithyan95845 жыл бұрын
Hi . How does the functions Input(),Draw(),Logic() work repeatedly (Like the snake keeps moving LEFT when we press key'A' once), even though we have not used any loops in the main() function
@sencerkaraduman9594 жыл бұрын
Too late but we have used a while loop in the main function. This would be the main function: int main() { Setup(); while (!gameOver) { Draw(); Input(); Logic(); } }
@TheDorkol53 жыл бұрын
It's at a lower scope so it doesn't get returned to defaults
@burningknight79 жыл бұрын
can you tell me which funtion or which part of the program lets us constantly get the output after we move the head?
@xajiraqab9 жыл бұрын
+burningknight7 Draw();
@bilgehansel1729 жыл бұрын
+burningknight7 I think you wrote _kbhit instead of _kbhit()
@dobbertje09516 жыл бұрын
I found it was better to put de Draw() function in the Setup function, and in the while loop after the Input and Logic functions. Because the user then has a tiny little bit to no input delay. While the original placement has very magnificent input delay.
@drinkurtishi87356 жыл бұрын
HELLO PLEASE, is there any way to stop the constant 'flickering' of the walls? please tell me :)
@reinhold16164 жыл бұрын
Nice, but i dont like how it flashes when it refreshes the screen, i rather made an array that had the characters inside it and then just overlayed the array on the screen so it wasnt flashing (i used pascal)
@huh59506 жыл бұрын
great video, just one question: my snake moves two steps at a time instead of one, what can I do?
@jweezy15able2 жыл бұрын
I'm running this under Code:;Blocks 20.03 and it tells me everything from Input after switch getchis "invalid conversion" or "inconsistent expression". Any pointers? Edit: I solved it. If anyone else has this issue, remember to put 'x' and not "x", or you'll get error coded. Ngl, was kinda hard to read so tell which one was used so I'm glad I only suffered minor set backs.
@muhammadreza80498 жыл бұрын
This is awesome to see for a beginner like me. Thanks guy! How to set the speed of movement, faster or slower?
@shaynejuggles9 жыл бұрын
when I switch my dir, it does not automatically print the cases underneath, any suggestions?
@niiloniminen86959 жыл бұрын
+Shayne Winn write switc and press down and then enter and then write di press down and press enter =) hope this helped maybe not you but someone that has the same problem
@drcvagos-iu8 жыл бұрын
Second question: In the Setup function, x and y are being initialized, in the draw function they are used with the same values as initialized, how comes that the values doesn't die. Sorry for these questions, I'm new to C++ programming.
@TM_Makeover3 жыл бұрын
Values are only used not consumed
@TM_Makeover3 жыл бұрын
Values are only used not consumed
@TM_Makeover3 жыл бұрын
Btw good question
@mikhapichkhadze28854 жыл бұрын
well i made this snake game in dev c++ and i just copied the logic what you writed and it worked i dont have any trouble
@onee0.016 жыл бұрын
Tks for your code. And you can make this game with pointer instead of array?
@ashhadkhan18718 жыл бұрын
Hello Sir. I am using Eclipse IDE and it does not recognize the function system("clr"). Adding conio.h library also does not help. I am a windows user. Please advice me what to do.
@jimbeammeup98795 жыл бұрын
for system("cls") you need to #include
@shohanrahman93925 жыл бұрын
Anyone else getting inverted controls? Like, mine starts off normally but 2 to 3 keystrokes in, each key does the opposite.
@kaspo18104 жыл бұрын
having the same issue
@araa51845 жыл бұрын
Anyone on osx or linux. The keyboard input can be change with including curses.h getch() is available but kbhit isn't but it still works.
@beckett76014 жыл бұрын
I'm on Linux (Pop!_OS) and kbhit works for me
@araa51844 жыл бұрын
@@beckett7601 I'm using the g++ compiler through terminal so its not included in the standard library or any library that I have installed. Unless I'm missing an include argument that I haven't found.
@beckett76014 жыл бұрын
Oh, yeah, it's not included in g++. I had to download conio.h. Here: github.com/thradams/conio
@edwinG6506 жыл бұрын
You sounded like the Terminator when you said, "game terminates", with accent and all. You should've said game terminated. Haha
@MsPistoler9 жыл бұрын
Awesome! You explain so clearly. Thank you!
@MrStevenplumb7 жыл бұрын
Am I able to make my border less "jumble" it moves constantly and it's hard to see where I am moving the snake!
@Baccarebel25808 жыл бұрын
YOU BUT THE y--; and y++; under the break statement @5:30
@r0x3045 жыл бұрын
No shit.. Really?
@ekyam28923 жыл бұрын
Im doing the same thing but its not working for me I am half way to giving up XD
@ishanpahwa11793 жыл бұрын
which IDE are you using? If you don't mind me asking.
@yyfoo7559 жыл бұрын
How can we use the arrow buttons on the keyboard to key in the input instead of pressing the alphabets (a, w, s & d)?
@yousefaweni30384 жыл бұрын
Help!!! The program keeps telling me the reference to 'left' is ambiguous what to do . Help please
@Viralfanatics4 жыл бұрын
Use LEFT and RIGHT instead of left and right.
@yousefaweni30384 жыл бұрын
@@Viralfanatics yes thanks i knew that a long time ago.
@jamesisgreat56349 жыл бұрын
But conio.h is only available on windows. Is there any way around this if I'm using a mac?
@hellomynameisorange28609 жыл бұрын
+James IsGreat Yea, buy a PC.
@mdyasin70087 жыл бұрын
i think this can be help you discussions.apple.com/thread/1176684?tstart=0
@ShizL7 жыл бұрын
Hello My name is Orange XDDDD
@3ndr3wmusic566 жыл бұрын
good one xD
@thorpedersen89818 жыл бұрын
at 9:02, what is he using, I's, ls or what? when he is adding something to the if statement if (x > width II (what is this? Last two things
@thorpedersen89818 жыл бұрын
I'm new to c++ :)
@KCBunne9 жыл бұрын
8:08 At this point my snake head is blazing fast, I can barely keep track of it. Is this because my computer is faster? Can I control refresh rate of the terminal?
@KCBunne9 жыл бұрын
+KCBunne BlubbeN ! 's comment fixed my problem
@philip49029 жыл бұрын
+KCBunne How?
@philip49029 жыл бұрын
+KCBunne Problem solved nvm
@I_love_pancakes-k4p6 ай бұрын
Not sure if anyone would see this, but I ran into a problem with the fruit placement on the map and I dont know how to solve it. The fruit is sometimes placed outside the map. Does anyone know how to fix this?
@xXPredator21Xx7 жыл бұрын
+NVitanovic Im using a Mac on eclipse and the _kbhit and getch wont work. People have said the conio.h will not work with it, so is there a replacement?
@chrysanthemon30403 жыл бұрын
how is your board on the console so calm? mine is flickering all the time, and i have sleep(100) and it still is flickering as hell. any ideas how to stop that?
@manelouafi96538 жыл бұрын
I use Linux...conio.h doesn't exist what can I do to replace kbhit() ?
@HellGod678 жыл бұрын
+Manel Ouafi if (key==75) dir==LEFT; if (key==77) dir==RIGHT; if (key==72) dir==UP; if (key==80) dir==DOWN;
@werewolf2189618 жыл бұрын
+Manel Ouafi perhaps you would like to refer to this page cboard.cprogramming.com/c-programming/63166-kbhit-linux.html
@arnold94488 жыл бұрын
"Key was not declared in this scope"?
@werewolf2189618 жыл бұрын
Check where you have defined variable key...and check if it is accessible within curly braces
@chinmayingle4238 жыл бұрын
include curses or ncurses at the start for Linux this will get the job done I suppose
@leeantoine9765 жыл бұрын
In visual studio 2019, it says 'DOWN' is not recognized in 4:11 Can someone please help and direct me on how to fix this issue?
@leeantoine9765 жыл бұрын
@@qrightdev what should I look for in the first video?
@rastor64844 жыл бұрын
How did the dir case appear automatically @5:00
@lonzeking10388 жыл бұрын
i have a problem , when i put switch (dir) into logic nothing happened and the letters weren't red i'm not sure if it caused it but my snake wont move at all
@learntime63576 жыл бұрын
hello dude my compiler has an error with this: if (_kbhit()) { switch (_getch()) it wrote that : main.cpp: In function ‘void Input()’: main.cpp:56:16: error: ‘_kbhit’ was not declared in this scope if (_kbhit()) ^ main.cpp:58:24: error: ‘_getch’ was not declared in this scope switch (_getch()) ^
@zarulhadi43907 жыл бұрын
why is my compiled game flickering??? how do i fix the flickering thing
@anujgore21757 жыл бұрын
Zarul Hadi The flickering thing is due to the fact that tge square frame is being drawn everytime. It requires some time and hence it flickers. I guess the flickering depends on the CPU speed
@dimensionalblade27785 жыл бұрын
6:09 to 8:00 yup that's me on while printing 'hello world'.
@اساور-و2ق3 жыл бұрын
شكرا جزيلا 💙💙💙💙
@farhanchohan24799 жыл бұрын
I was thinking how two functions can execute simultaneously..... Moving the snake and catching the input..... program control works in sequence.... how can it go to the input function without completing execution of draw.....?
@shreyasrajapurkar38169 жыл бұрын
+Farhan Azam hello! i am not a pro but...yes the program control works in sequence...what do you mean how does it go to the input function without completeing the draw? the draw function's job was to just create the walls! so the draw function has been executed (which you know because you can see the walls there)...and THEN you input your key and then the snake moves (whch is done by the logic function). so every thing is in sequence i suppose...i am just a beginner and only hlfway through the video and i cant continue becuse i am facing some problems and i cant figure it out...so my answer has a really high probability of being wrong XD but since there was no answer to your comment so i thought that i should provide my views. cheers :)
@farhanchohan24799 жыл бұрын
I have developed it completely..... I have understood everything when I dry run every step. Now I know how snake is continuously moving and how you can input your keys. What problems are you facing ?
@NVitanovic9 жыл бұрын
+Farhan Azam Sorry for not being able to explain this more in detail, videos would be a lot longer than they are currently. I'm happy that you managed to sort things out on your own and that's a big plus in your case. If you have any questions currently please reply to my comment. Thanks for watching! Best regards!
@farhanchohan24799 жыл бұрын
And also tell you something that in this video there are some logic which can confuse you. like kbhit logic using switch statement. In this video it is used twice whereas it doesn't need like that. The only thing which I had referred from this video is where to put the snake movement logic which I could had done if I think a little more. I regret for it. So if you will see this logic and implement it you will never learn to do yourself. Programming depends on logic and if you can't design a logic then you are not a good programmer.
@NVitanovic9 жыл бұрын
+Farhan Azam I've made a lot of versions of this game on the similar principle. It's hard to implement this kind of game with limited features that console offers, there are by the way libraries that let you handle console drawing more easily. The library is called "ncurses" and it would help drastically to make a game look more fluid. You can also do it graphically by using SFML or plain SDL. As for the input, If I wanted to make a real game I would use an input library or SFML or native windows API for doing so. The problem is that I couldn't as I didn't mention these libraries or showed viewers how to use other libraries. The logic part is of course up to you, and it is normal that it varies, not all people think the same :). I had to adapt the game to the tutorial series knowledge as most of the viewers are here still learning. If you want you can share your code here so other users can see your code and you may help them :). Best regards!
@beesleyrc7596 жыл бұрын
I have a flickering line on my game, any fixes?
@mose999 Жыл бұрын
thx it's helpful for me a newbie
@jjwwe27122 жыл бұрын
Awesome material
@Caulin_3 жыл бұрын
When I include the conio.h library it includes but there are a bunch of warnings
@amnaiqbal83072 жыл бұрын
I am following the tutorial as it is but my screen keeps flickering and reprinting my for loops...? What should i do?
@Loose_DP4 ай бұрын
Ok so i ran into a problem. Somehow in Void Draw() VS doesnt has x, y with the value of 10, but with the value of 0 instead. Even thoug it appears to do the divison of height and width in void Setup() If i write the divison of height and width to save it in x, y in int main() it works......BUT WHY? I wrote everything exactly the way shown.....
@Loose_DP4 ай бұрын
NVM im Stoooooopid. didnt out Setup() in main LOL
@monome30388 жыл бұрын
keep making the good videos please! thank you!
@edsan4495 Жыл бұрын
When the code runs, it's followed by a "press any key to delete the screen" even though i have put the _ifkbhit(). What can i do to make the screen wait?
@ThisIsMMI5 жыл бұрын
In 5:04 why did you remove case STOP ? I am finding the this when I remove case STOP from the switch. warning : enumeration value 'STOP' not handled in switch [-Wswitch]. What should I do? Please help. ( I am using codeblocks). If you have any suggestion, please type the full code snippet when replying. Thanks in advance.😁