Love your tutorials! It would be really cool if you continued the series in something like unreal engine and continue making simple games but with basic graphics so we have better idea of how to go about making a real game :) Thanks!
@DogeCharger4 жыл бұрын
Thanks for this tutorial! By the way, if anyone wants to get rid of the flickering, the main cause of it is using the "cls" command in draw. It's pretty tedious this way since it forces the screen blank and causes significant I/O delay. Using this solution eliminates the flickering almost entirely! void clearScreen() // Use Direct implementation of "cls" to clear screen without flickering! { HANDLE hOut; COORD Position; hOut = GetStdHandle(STD_OUTPUT_HANDLE); Position.X = 0; Position.Y = 0; SetConsoleCursorPosition(hOut, Position); }
@cheekybiscuit57422 жыл бұрын
where do i place this code in the script, thanks ?
@tomewa24512 жыл бұрын
Yes. Where do I place it?
@doron9103 жыл бұрын
Yo Thank you!!! I'm a beginner Why should you have the player and the ball objects as dynamic "heap" memory" actually? An explantion would be really interesting.
@CoolDude608749 жыл бұрын
Thank you again! You are like teacher,that helps alot when you show how that works :) Keep it up!
@qwerty111111229 жыл бұрын
Ah, thank you so much! It's nice to to see a pong game tutorial online where I can learn the graphics separately from the OOP.
@RainbowSheep_was_taken5 жыл бұрын
charmap was the best thing that I've ever learned before thank you very much
@robmarvinzcajayon26398 жыл бұрын
tried to run the program but there's an error - "cGameManger has no member named draw"
@shedexqwerasd12999 жыл бұрын
Nice tutorial, well done! But there is one thing i didnt understand, why do u use pointers on the ball and the players ?
@NVitanovic9 жыл бұрын
+Shedex QWERASD So I can initialize them when the constructor of the GameManager class is called, and also in order for us to be able to use the ScoreUp function. It could have been done without them, but practice is always good, this is a 21st tutorial so I use some concepts that you have learned before in order for you to practice.
@shedexqwerasd12999 жыл бұрын
+NVitanovic okay, thank you :D
@yifei_yin8 жыл бұрын
I like the way you making video, it is extremely helpful! Looking forward your next video!
@eslamabdelnaeem80475 жыл бұрын
I have just ended my c++ and oop course , should I start to creat a game like this as a training course. Or should I learn some thing else?
@yogihendrawan39914 жыл бұрын
Thank you again :) I really really enjoy it to make and play the game
@ratchetclan39 жыл бұрын
Why did the ball go straight at 25:25 instead of reflecting at an angle?
@NVitanovic9 жыл бұрын
+Ryan Conway (Surreali) Because the bounce direction is randomly chosen. The logic for the bouncing should be more complicated, but I've tried to simplify it more in order for the game to be simple enough and to fit the tutorial in 3 videos.
@АндрейКороховой-т4о3 жыл бұрын
Thank you very much for the lesson, I was glad to learn something new, because programming in Ukraine is poorly taught. And the term paper somehow needs to be done))) Thanks again, good luck in life and further steps ...
@Outreal1 Жыл бұрын
Great tutorial on C++ pong! FYI looks like your source code link has been hijacked by spammers, it keeps redirecting me to dodgy sites. Can you paste the code on here?
@oleksandrsavchenko19618 жыл бұрын
Hi, NVitanovic! Thanks for your tutorials. I use Visual Studio 2012. And in line 80 when I try to type "cPaddle(int posX, int posY) : cPaddle()" Visual Studio show me an Error:"cPaddle" is not a nonstatic data member or base class of class "cPaddle". Do you not what it could be?
@oleksandrsavchenko19618 жыл бұрын
When I set comment before : cPaddle(). Error go away And my left paddle doesn't move. But when I hit keys 'i' or 'k' ball start running.
@bilbobaggins78587 жыл бұрын
Is there a way to clear the console screen without causing the flicker?
@lunapictures79897 жыл бұрын
Yeah, there are even simpler methods using just iostream and windows.h (if you still need it I can record a fast tutorial)
@Stek40Channel7 жыл бұрын
It would be awesome id you do it :D
@lunapictures79897 жыл бұрын
Aaaand I did it. Just rendering, uploading and it will be on my channel. And I'm really sorry that it's not the best tutorial but I have really no expirience in doing them. But I think that everything important is there.
@heheminroev7 жыл бұрын
it is a really great tutorial just wanted to ask about the flicker aswell. can see you would upload a fix but can't see it yet;(
@lunapictures79897 жыл бұрын
Brian madsen For my tutorial I've sent a working code. So after adding this to your project it should work. The only thing I could maybe add to make it even better is making the cursor not visible. I'll do an update if a have a time. ;) Have a nice day
@manriqueiriarte82687 жыл бұрын
what if you don't have access to conio,.h and can't use _kbhit ?
@ItsMyWorld24 жыл бұрын
'_kbhit()' lies in 'conio.h'. If you do not insert 'conio.h' '_kbhit()' will not work.
@citizendot18003 жыл бұрын
Use ncurses library
@tokugeeky29312 жыл бұрын
Thank you, this is so helpful
@style_1312 күн бұрын
how do u slow the ball speed? also stop the flickering? :))
@jimchan21148 жыл бұрын
Amazing! Just Simple and fun!
@billc1196 жыл бұрын
charmap!! I didn't know that, and it makes the game much nicer
@jctagaming97744 жыл бұрын
hey thanks allot i rilly liked the videos it helped allot rilly but is there any way to stop the flickering on the game it wold rilly help me thanks..
@aakashshah18223 жыл бұрын
did you get any solution?
@jctagaming97743 жыл бұрын
@@aakashshah1822 no 😓
@cpt_badass52238 жыл бұрын
hi i love your tutorials i have just one question how do i stop the game from flashing as the walls the ball and the paddles keep flashing how do i stop this so that they don't flash anymore
@shinab23773 жыл бұрын
If you draw the walls in the main function , it should stop blinking. But the paddles would be blinking.
@elvinosas8 жыл бұрын
Are you going to make opengl with c++ tutorials in the future?
@JoeExpress8 жыл бұрын
Super!!!Great job!!!I like your tutorials NVitanovic!Continue!!Like like like
@עמיתעמר-מ1ל8 жыл бұрын
love ur vids keep the hard work
@vectordhruv89083 жыл бұрын
Really amazing 🔥🔥
@vlads-succes38458 жыл бұрын
Hi, first of all i want to dowload c++. Can you do this in your next tutorial? I really need this NVitanovic. YOU DO A GOOD JOB HERE!!! Hope you'll do that👍🏼👍🏼👊🏼
@gjciener53604 жыл бұрын
In the input function in the game manager it says that _kbhit() and _getch() are undeclared identifiers. how do I solve this?
@ssss-ph6zl Жыл бұрын
i need the source code it does not open fro the discription
@sasa-dc1gb4 жыл бұрын
conio.h doesn't support my compiler :(( any suggestions for the alternative?
@rubyPWNS18 жыл бұрын
I really liked your style of teaching C++. It's was very simple but still well enough. I wish you continued, or maybe did the same for Java.
@SCARRIOR8 жыл бұрын
Java is inferior to C++
@exitplanetduster3 жыл бұрын
That is an impressive result for a text based game. Is there a way to avoid that flickering?
@alexanderweber56353 жыл бұрын
También estoy buscando solución a eso. Por lo que tengo entendido, debo darle un tamaño fijo a la pantalla para poder sobreescribir el texto en lugar de borrarlo y volverlo a escribir.
@yusufharuna62907 жыл бұрын
Thanks you very much for this vedio series.
@booomlegshot7 жыл бұрын
on the For loop that draws the ball, player1 and player2 my cout
@booomlegshot7 жыл бұрын
lol never mind i missed a == only had =
@thePadlockesTech3 жыл бұрын
This was good. But, how do you determine a way to change the direction into something other than random when it hits the paddles? The original Pong uses physics (basically) so if the ball is coming upright and the paddle hits it from a certain angle it responds by going upleft instead of a random direction.
@atlantic_love2 жыл бұрын
It's all about the angles.
@johnniefujita5 жыл бұрын
less verbose (player1x == j && (player1y == i || player1y + 1 == i || player1y + 2 == i || player1y + 3 == i)? or do you preffer the full conditional else if sequence? i think this way gives the beginner a more spacial feeling of the window
@dragospredi86648 жыл бұрын
@NVitanovic Very nice tutorials. If you could continue and maybe make such simple games with OpenGL or SDL libraries so it would be an actual game it would be great, and I believe that many people that watch your tutorials agree :)
@hananeikh6 жыл бұрын
i agree 100%
@LetsMineSomeBlocks9 жыл бұрын
is there a way to make this into a program so it is on your desktop and you can click it to open it?
@ttqgrowtopia78976 жыл бұрын
if you didn't get the answer, when you compile it, it creates the .exe file( the program) that you can open and the program will run, did it help?
@emilovici86888 жыл бұрын
How can I make the pads move simultaneously?( I mean, when I press two keys at once: 1 for first's player pad and the other pad for player 2)
@NVitanovic8 жыл бұрын
It's not possible in this kind of implementation to do so. This is done in the console so the console accepts one key at a time. You can use though a library that will allow you to do similar things. Start with SFML it's a library for 2D games and it contains advanced input.
@ItsMyWorld24 жыл бұрын
sir can u tell me how to stop blinking the program🥺🥺
@aakashshah18223 жыл бұрын
i have same problem did you get any solution?
@ItsMyWorld23 жыл бұрын
@@aakashshah1822 no
@JohnSmith-kw4xu8 жыл бұрын
Also, why did you set the variables ballx, bally, player1x, etc. if you could just use the values directly? e.g. ball->getX instead of ballx.
@atlantic_love4 жыл бұрын
Because he didn't know how to design classes.
@robigo99127 жыл бұрын
Hi there! Could you pls explain how to implement that sleep function into the code? The game flickers very much and it's not really playable. Thx in advance!
@Reaper7mk7 жыл бұрын
just put sleep(50) in the main loop at the end of each iteration. So it would look like: while(!Quit) { Draw(); Input(); Logic(); Sleep(50); }
@aakashshah18223 жыл бұрын
@@Reaper7mk it just slowdown ball and frame can you please provide any proper solution? thanks in advance
@Entropy3ko8 жыл бұрын
Great stuff! Upload more! :)
@corbax21894 жыл бұрын
i love your videos and great tutorial like all others. i just wanted to say that i noticed a small bug. when the ball touches right paddle it can disappear and i need to restart the game. can you or someone else explain why is that happening. all and all great video
@thePadlockesTech3 жыл бұрын
The ball disappears after it touches the right paddle? There's a chance the code might be slightly off in the logic function.
@PhasePD7 жыл бұрын
dude i have looked thru the playlist with your c++ tutorials, you dont have pipes, why?
@SkiNNyPoNNy6 жыл бұрын
whats pipes
@lecomp4 жыл бұрын
I am doing this code on my Ubuntu. At the end of this video, I had problems during the compilation as described below: undefined reference to 'initscr' undefined reference to 'stdscr' undefined reference to 'wgetch' Here is the part of the code error: if (initscr()) { char current = getch(); if (current == up1) if (player1y > 0) player1->moveUp(); if (current == up2) if (player2y > 0) player2->moveUp(); if (current == down1) if (player1y + 4 < height) player1-> moveDown(); if (current == down2) if (player2y + 4 < height) player2-> moveDown(); if (ball->getDirection() == STOP) ball->randomDirection(); if (current == 'q') quit = true; } Here are the libraries: #include #include #include #include #include
@michaelcastillo8847 жыл бұрын
when i put #include and compiled it it said that there was no such file or directory- any solution ?
@usamamuzaffar91746 жыл бұрын
in dev c++?
@arunmohanc60315 жыл бұрын
I have also that kind of problem and what did you did
@abdelrhmanelsaid45897 жыл бұрын
AWESOME Thank alot bro :) Guys console screen so hard to make games :) need high logic ^^
@Zly_u9 жыл бұрын
Can I make this game not in console? I want to make game like this but with graphics. Can I do it in VS?
@NVitanovic9 жыл бұрын
+Zlyudchik Yes you can, and if you want share the code with the others.
@Zly_u9 жыл бұрын
ok thanks!
@omgfmaftw8 жыл бұрын
+Zlyudchik hey dude did you manage to make one? if so how did you build a GUI for it?
@Zly_u8 жыл бұрын
+fmaftw no, not yet, I not active learning C :/
@mattiafontana22648 жыл бұрын
+Zlyudchik , you can do that whit C/C++ and OpenGL libraries. If that is too hard, i advice to use the SFML lib.
@Anwari703 жыл бұрын
Source code isnt opening?
@brattergaming92764 жыл бұрын
I get an error that says "player1 : undeclared identifier" and same with player2
@JohnSmith-kw4xu8 жыл бұрын
WriteConsoleOutput() will remove the blinking and improve rendering times.
@hendrik27658 жыл бұрын
can you pls say where i am a c++ noob ;D
@trungnguyennhat71525 жыл бұрын
Cam on Ban rat nhieu! I'm come from Viet Nam!
@El_kammex3 жыл бұрын
Why we don't need a sleep() function in this game and its work perfect?
@danield4n13l6 жыл бұрын
lol made this, and if the direction is upleft when colliding with top, it does nothing... same when downleft when colliding with bottom can you guyz help me?
@tylerhoyt99508 жыл бұрын
How do i use sleep to not make my screen flicker
@NVitanovic8 жыл бұрын
If you set the sleep value too high it will flicker less but the input won't be that responsive. It all goes down to guessing the value for your PC.
@Fixy152 жыл бұрын
Source code is not working for me :/
@creative19788 жыл бұрын
Great job!!!!!!
@siddhantbhardwaj26498 жыл бұрын
Bro, Where do i add the sleep function if i dont want my game to flicker?
@tylerhoyt99508 жыл бұрын
RIght after Logic in the run function
@lilqueen2798 жыл бұрын
HELLO THERE.WHAT IS THE OBJECTIVE OF THIS GAME? AND THE MINOR OBJECTIVE. THANKYOU
@randominternetuser51235 жыл бұрын
i know this comment is 2 years old, but seriously? you dont know pong? smh -_-
@coffeecatrailway7 жыл бұрын
only one player can move at a time. How can I fix it?
@hoangminhnguyen28403 жыл бұрын
thank you
@sameershah61744 жыл бұрын
What should i do to stop blinking in the game
@sameershah61744 жыл бұрын
@NVitanovic
@MrEmpirz4 жыл бұрын
thank you bro
@FaizanIzen7 жыл бұрын
Thanks a lot brother
@cyndymyndy85167 жыл бұрын
your tutorial is awesome but could you plzzz tell why does the screen blinks at last and how to fix it
@VirTuneCS7 жыл бұрын
It's because System("cls") clears the screen then you are redrawing it again, causing the blinking
@cyndymyndy85167 жыл бұрын
but how to fix it???
@varusmaster7 жыл бұрын
you are the best
@SebastianClarence9 жыл бұрын
do I use empty project
@lijack4567 жыл бұрын
please design a new tutorial~ its really helpful,thanks you
@voxcake8 жыл бұрын
Thanks you very much! :D
@herooyyy8 жыл бұрын
My console close right after I run it. How do I fix that?
@thegodofmusic29048 жыл бұрын
+DroonDZN You probably still have the return 0; statement at the top of the main function like this: int main () { return 0; // Other random code. } Simply place the statement at the bottom of the function or comment it out and the console should run fine.
@judewoolls62728 жыл бұрын
Please help my two paddles are both on the same side anyone got suggestions
@BTechPrasad5 жыл бұрын
thanks a lot
@hoangminhnguyen28403 жыл бұрын
can you give me code
@jjeon98507 жыл бұрын
Where is the value of player2x inputted?
@mohamedsalah72865 жыл бұрын
how can i stop this blink
@ballacknugraha72367 жыл бұрын
absolutally asik this game browh :D:D:D, thank you sir, terimakasih
@SebastianClarence9 жыл бұрын
mine said rand is not declared in this scope
@m.o.s62756 жыл бұрын
my code block say same thing but i include stdio.h and stdlib.h and it work for me i have no idea how i fix it, but it work and now i try to fix c.???
@Nick-jb4xi6 жыл бұрын
If I play long enough, eventually my ball refuses to leave the center. I can still move the paddles though. Has anyone else had this problem?
@atlantic_love2 жыл бұрын
I haven't looked at all of his code in the videos for this game, but I'm thinking he generated direction of the ball from the center using a random number. There is an algorithm I found late last night to help me solve the exercise I'm working out of a Stroustrup's C++ book. Before I found that algorithm on Stack Exchange I was loosely getting a random number (using rand() ) in the range I was looking for, but for whatever reason I started getting random numbers outside the range I was looking for. Here is the algorithm I found that keeps random numbers within desired range using rand(). int getRandomInt(int max, int min = 1) { return (rand() % (max + 1 - min)) + min; }
@ilias-achahbar8 жыл бұрын
So why does the game actually flicker?
@aakashshah18223 жыл бұрын
did you get any solution?
@cassu66 жыл бұрын
for some reason my paddles dissappear after the first "goal"
@arduino18712 жыл бұрын
7:19
@lazizjonnasriev61235 жыл бұрын
Why we need time.h header in this program
@ЛилиСтефанова-д6х3 жыл бұрын
To call the srand function
@asadelahi96888 жыл бұрын
+NVitanovic plz upload the video how to make chess game plz +NVitanovic
@Nick-jb4xi6 жыл бұрын
lol, that would be like 10 videos probably
@negativaura8 жыл бұрын
wow programming is hard and i thought this was simple games to make and u wrote about 300 lines of coding wow.
@atlantic_love4 жыл бұрын
In a couple of places early on, he had a lot of redundancy, and unnecessary methods. No way PONG should require anywhere near 300 lines of code.
@nikiforovpteacher3 жыл бұрын
This code does not compile in VS2019. 10 mistakes.
@abdelrhmanahmed13784 жыл бұрын
you can also just put if (x == width-3) , think about it and thank me later
@asadelahi96888 жыл бұрын
sir plz upload the videos how to make chees game thanks