🔥Pong Game with C++ and Raylib - Beginner Tutorial

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024

Комментарии • 90

  • @programmingwithnick
    @programmingwithnick  Год назад +9

    I hope you took away lots from this video. Let me know below!
    PS. Check out my Android Game called Quiz of Knowledge. I am sure you are going to like it.
    bit.ly/QuizOfKnowledge

  • @PektraNao
    @PektraNao 4 дня назад +1

    I just finished school in programming. It was 18 months. I learned c#, kotlin, html, css, js (node, express), sql, mongodb but i always wanted to learm C and C++ because I want to pursue a career in the gaming world as a developer. Throughout the education, i had to use stack overflow and chatgpt to help me with projects( i know i shouldnt depend on chatgpt) because i couldnt understand the books and my teacher (it was an online class). You are the only one so far that explains every code and why its written that way (function, class, etc). I cant thank you enough!!!

  • @Zivvv187
    @Zivvv187 Год назад +18

    Wow!
    I just wanted to say THANK YOU for making these Raylib tutorials.
    You are excellent at describing WHY we write the code (the most crucial aspect of learning), both while you code but also before we start to code when you break down what we are gonna do.
    Sometimes I loose interest in a tutorial when the person is not explaining and or has a pedagogical way of explaining. But I've been glued to your Raylib videos!
    Please don't stop doing Raylib tutorials, you are the best I've seen on RUclips regarding c++ game programming (and I really mean it)!!

    • @programmingwithnick
      @programmingwithnick  Год назад +2

      Thank you very much for your kind words! It means a lot. Messages like yours, keep me motivated!

  • @americamtheantitankie4843
    @americamtheantitankie4843 11 часов назад

    Amazing Tutorial! Thank you for making it! this tutorial only needs to set a winning max score and sounds when the ball collides with the paddles and walls and when either side scores a point.

  • @sobottrachhuth75
    @sobottrachhuth75 Год назад +6

    I really like the way you break everything down, it really helps with understanding what's going on. I hope you will continue to make more contents. Thank you so much!

  • @D3ss3rtTV
    @D3ss3rtTV 3 месяца назад

    If I would've found your channel earlier, I would be a game dev by now, thanks for all the hard work you put into these videos.

  • @syedshow811
    @syedshow811 5 месяцев назад +6

    your contents are far better than the contents in paid Udemy courses!

    • @programmingwithnick
      @programmingwithnick  5 месяцев назад +6

      Thank you very much for the feedback. I wan to create the best possible free content available. It seems I am on the right track.

  • @chalkypj
    @chalkypj Год назад +3

    Thank you for such a fantastic tutorial. I have taught myself python and found you via your pong pygame video. I spent time a couple of years ago trying to teach myself C++. This tutorial has now whetted my appetite to try and continue this journey. I look forward to what you post in the future.

    • @programmingwithnick
      @programmingwithnick  Год назад +5

      Glad to hear that you found the tutorial helpful and that it has inspired you to continue learning programming! Learning by building games can definitely be a fun and rewarding way to learn a new programming language. By the way, I'm currently working on a new video tutorial for creating a Snake game in C++, which I think you might find interesting. Stay tuned for that, and let me know if you have any questions or need any help along the way!

  • @charlesg.smithjr.3677
    @charlesg.smithjr.3677 10 месяцев назад +1

    I followed your step by step tutorial on how to set up raylib in Visual Studio 2022. You made it super easy to follow along with you awesome job.

  • @TheSelfUnemployed
    @TheSelfUnemployed 3 месяца назад

    Incredible tutorial! I just started programming and chose c++ as my first language. Ive done many tutorials even another pong video but it was convoluted and didnt explain what the code did or how to break it down into small problems. Thank you so much for this knowledge! On to Snake now!

  • @dabunnisher29
    @dabunnisher29 2 месяца назад

    Your explanation is REALLY FANTASTIC!! You got me subscribed and thumbs up in Vegas. Thank you!!!!

  • @akaa3144
    @akaa3144 7 месяцев назад +2

    Hey man, I wanted to thank you for this tutorial, I've been learning a lot with it! I'm definitely looking at you snake tutorial next! As well, this type of tutorial motivates me more, in becoming a c++ dev!

    • @programmingwithnick
      @programmingwithnick  7 месяцев назад

      You can do it. Watch the snake game tutorial, next the Tetris game tutorial, and next the Space Invaders tutorial and you will able to build simple 2d games on your own.

    • @akaa3144
      @akaa3144 7 месяцев назад

      @@programmingwithnick Will do, thank you!

  • @MrRajan-km5gg
    @MrRajan-km5gg Месяц назад

    very good tutorial and good explanation, thank you .

  • @dp2120
    @dp2120 6 месяцев назад +1

    This was incredible. Thank you so much!

  • @ManulF-rm8em
    @ManulF-rm8em 6 месяцев назад +1

    Great Tutorial. It helped me A LOT!

  • @blazexy5657
    @blazexy5657 Год назад +2

    Man this is really helpful can you do more tutorial in C++ like making enemies and also doing 3D game dev stuff

  • @chakerjouini
    @chakerjouini 2 месяца назад

    True gem , exactly what i needed ! thank youu

  • @OktatOnline
    @OktatOnline Год назад +1

    Let me just point out that in the beginning you show 1 big thing broken down into 9 smaller things to showcase the divide & concquer method.
    Let me also say that the video is made up of 9 parts of actual coding. :D
    Satisfying.

  • @AaliJahBaig
    @AaliJahBaig Год назад +1

    Amazing video dude! thank you so much for making this.

  • @rajithlahiru5580
    @rajithlahiru5580 Месяц назад

    Thank you!! This helps a lot!!

  • @MortySmith-ji2fx
    @MortySmith-ji2fx 9 месяцев назад +1

    Awesome tutorial!!! THANKS A LOT!!!

  • @lomvil
    @lomvil 2 месяца назад

    It's awesome video, thank you!

  • @staymotivated628
    @staymotivated628 Год назад +1

    Legendary tutorial

  • @nokia_n-gage
    @nokia_n-gage 10 месяцев назад +1

    Thank you for a super tutorial!

  • @MinerBruh
    @MinerBruh Год назад +2

    Hey Nick I'm really excited for the next tutorial as this one is very well explained and I understood it easily. Keep up the good work (Επίσης είμαι και εγώ Έλληνας :))

    • @programmingwithnick
      @programmingwithnick  Год назад

      Hey, thanks for the comment! I am really excited for the next video as well! It will be my best so far! Γεια σου πατρίδα, αν φτιάξεις κάτι καλό να μου το στείλεις να το δω!

    • @MinerBruh
      @MinerBruh Год назад

      @@programmingwithnick I will for sure!

  • @meminhofuny
    @meminhofuny 11 месяцев назад +1

    awesome video, God bless you for your channel

  • @thomasengland1701
    @thomasengland1701 10 дней назад

    Couple of things, you really should make the member variables private and have appropriate setters/getters, in addition, the naming of the variables should be more descriptive, x can refer to many things, position_x or positionX would be an appropriate name.

  • @Tims_Projects
    @Tims_Projects Год назад +2

    Loved it. 👍

  • @SashaIraq
    @SashaIraq Год назад +1

    Super! Thanks You for the lesson.

  • @Dustlantic
    @Dustlantic Месяц назад

    Great videos thank you

  • @aaabbbccc899
    @aaabbbccc899 6 месяцев назад

    THANKS, i made my first game!

  • @davidefarona
    @davidefarona 3 месяца назад

    Thanks this is gold, keep it up plz

  • @sinahasani5736
    @sinahasani5736 16 дней назад

    You are amazing bro I try to make it with SDL2

  • @diegoaredes2721
    @diegoaredes2721 6 месяцев назад

    Awesome video

  • @arfihussain6172
    @arfihussain6172 Год назад

    Awesome tutorial 👍

  • @evertgoran
    @evertgoran Год назад +2

    Thank you for a great tutorial! One question though, and my question might be off but, delta time was not used for the movement of the ball nor the movement of the paddles.
    Is this because you know that your computer will be able to run the pong game at 60 FPS at all times? If you were to make the game available for anyone, would you then use delta time for the movement?

    • @programmingwithnick
      @programmingwithnick  Год назад +4

      Yes, since this is a super simple game, very computer can run it fast enough. This makes things easy. If I remove the fps limit, my computer can run the game at 5000 fps. Check the latest video on my channel for more info.

  • @AlaaAreesPhoenix
    @AlaaAreesPhoenix Год назад +1

    Thanks very much this is one of the best tutorials for beginners about both raylib and oop abilities in c++ , thank you a lot sir💙
    But just a small question , do you need any extra extentions to run this on vs code? (Execpt the c++ extension of course)
    And using codeblocks will do the same work right?

  • @manuelgarciagarcia2501
    @manuelgarciagarcia2501 Год назад +1

    Fantastico tutorial,es tan bueno que hasta yo que no se ingles he podido seguirlo sin problemas.Sigue haciendo mas video de raylib que son muy buenos.
    No se si te molesta que publique en español pero me es mas comodo que usar el traductor de google,pero si hay algun problema puedo usar el traductor.

    • @programmingwithnick
      @programmingwithnick  Год назад

      ¡Muchas gracias por tus palabras! Me alegra saber que pudiste seguir el tutorial a pesar de no hablar inglés. Continuaré haciendo más videos sobre raylib y trataré de hacerlos lo más claros y fáciles de entender posible. ¡Gracias por seguirme!

    • @manuelgarciagarcia2501
      @manuelgarciagarcia2501 Год назад

      @@programmingwithnick Podrias en proximos videos,hacer un juego con dos niveles y ver como se puede pasar de un nivel a otro.Y tambien me gustaria saber como pausar el juego

  • @Bbdu75yg
    @Bbdu75yg Год назад

    Beautiful ❤

  • @MoviestarsEnglish
    @MoviestarsEnglish Год назад +1

    Wow, Excellent tutorial! I loved it! You have a new subscriber! Would it very difficult to do the same Pong Game in Unreal Engine 5?

    • @programmingwithnick
      @programmingwithnick  Год назад +2

      Thanks for the sub! I have no experience with Unreal Engine so I can't help you with that. Sorry!

    • @MoviestarsEnglish
      @MoviestarsEnglish Год назад +1

      Hi Nick, no problem! Thank you so much for your excellent videos. Have a nice day!

  • @cyberghot6902
    @cyberghot6902 2 месяца назад +2

    Yes i do ti Game Creating for Beginers😅

  • @HoangHarry
    @HoangHarry Год назад +1

    may i ask, if i compile the project using your makefile, will i have to ship the game with all the assets and .dll files?

  • @jefftamatthew
    @jefftamatthew 5 месяцев назад

    Hi Nick, loved your tutorial videos. I want to ask, is there a way to make all of these game projects without needing to delete the main.cpp source code and rewrite it all and instead make a new file and write the code there? Thank you in advanced!

  • @pointshootgo
    @pointshootgo 2 месяца назад

    for some reason whenever i run the program the ball keeps hitting an invis wall at x being 781 i have no clue what the reason could be because to me it looks like i did everything like the video showed

  • @docboisgameplay4245
    @docboisgameplay4245 Месяц назад

    I am getting at CheckCircleCollisionRec saying narrowing of int to float

  • @TrySomeCG
    @TrySomeCG Месяц назад

    ball is moving back and forth on x axis in very small distance when i add circle rect collision code, it works file if i comment it, any idea what light be wrong?

    • @TrySomeCG
      @TrySomeCG Месяц назад

      nevermind, fixed it

  • @Phonk-y2f
    @Phonk-y2f 4 дня назад

    Any help I am getting fetal error not found in such directory

  • @ledschmidt1441
    @ledschmidt1441 5 месяцев назад

    This is terrific!!! I'm 90% into it and just have the players paddle moving inside the screen, however I seem to have TWO player paddles as one does move up and down, and another is stationary in the middle position???? Can't find the code issue causing this? Thanks!!

    • @junaidsultanxyz
      @junaidsultanxyz 5 месяцев назад

      class Player {
      public:
      float x , y;
      float speed;
      float height, width;
      KeyboardKey key_up, key_down;

      Rectangle rec = {x, y, width, height};
      void draw()
      {
      DrawRectangle(x, y, width, height, mainTheme[3]);
      }
      void update()
      {
      if (IsKeyDown(key_up))
      {
      if (y > 10) // moving only if its within the field
      {
      y -= speed;
      }
      }
      if (IsKeyDown(key_down))
      {
      if (y + height < display_height - 10)
      {
      y += speed;
      }
      }
      }
      };
      class Computer : public Player{
      public:
      void update(float ball_y, float ball_x)
      {
      if ((ball_y < y + height/2 && ball_x > display_width/2) || (ball_x > display_width/4.5 && ball_x < display_width/2.6)) // extra condition for more interactive bot
      {
      if (y > 10) // moving only if its within the field
      {
      y -= speed;
      }
      }
      if ((ball_y > y + height/2 && ball_x > display_width/2)|| (ball_x > 20 && ball_x < display_width/5))
      {
      if (y + height < display_height - 10)
      {
      y += speed;
      }
      }

      }
      };

    • @junaidsultanxyz
      @junaidsultanxyz 5 месяцев назад

      i hope this helps, its a better version of the one in vid

    • @junaidsultanxyz
      @junaidsultanxyz 5 месяцев назад

      i just set it so that it can only move within the bounds

  • @dipcrew7337
    @dipcrew7337 Год назад +1

    εισαι ωραιος

  • @RomanWaves
    @RomanWaves 5 месяцев назад

    Thanks a lot :) one question ... there is a weird edge case for the collision, where the ball gets stuck in the paddle and is thrown back and forth. It happens when you catch the ball with the edge of the paddle. Is there a way around this ? Looked in documentation and web but wasnt able to find a solution

    • @dahoppin1008
      @dahoppin1008 3 месяца назад

      Did you manage to fix it?

  • @sarkkk2134
    @sarkkk2134 5 месяцев назад +1

    how should we set-up raylib library before using it in this project ?

    • @programmingwithnick
      @programmingwithnick  5 месяцев назад +1

      Check this video: ruclips.net/video/PaAcVk5jUd8/видео.html

    • @sarkkk2134
      @sarkkk2134 5 месяцев назад +1

      @@programmingwithnick ok thanks

    • @sarkkk2134
      @sarkkk2134 5 месяцев назад +1

      @@programmingwithnick hello I just completed creating the whole game, now I decided to create something more and male a menu screen which has start and exit buttons, so i came across raygui i wanted to ask how should I link raygui in the starter raylib template folder structure taken from git

  • @R2Sam
    @R2Sam Год назад

    Any plans on doing some sort of networking with raylib, always wanted to but never knew where to start

  • @rubialugattimoreira1978
    @rubialugattimoreira1978 Год назад

    👍❤️👏👏

  • @ZainAhmad-jl4vt
    @ZainAhmad-jl4vt 10 месяцев назад

    I did make Pong with olc PixelGameEngine

  • @qbixmex
    @qbixmex Год назад +1

    The big question, how can I win a score to cpu_player ? Because cpu_player never loose

    • @programmingwithnick
      @programmingwithnick  Год назад

      You can decrease the cpu speed variable, increase the ball.speed variable or alter the AI algrotithm to move only when the ball is its part of the screen for example. There are many ways to achieve it.

  • @ankanray962
    @ankanray962 8 месяцев назад

    Why is ball.Update called before ball.draw?

    • @treyabolicum
      @treyabolicum 4 месяца назад

      because code gets executed from top to bottom, logically it makes more sense to update the position before drawing the ball on the screen again, right? :)

  • @rutgerkanarek1883
    @rutgerkanarek1883 Год назад

    💪 𝔭𝔯𝔬𝔪𝔬𝔰𝔪

  • @dimasbajuri
    @dimasbajuri Год назад

    Your tutorial was excellent! I loved how you broke down the steps and provided clear explanations.
    btw, you have an instagram?

    • @programmingwithnick
      @programmingwithnick  Год назад +1

      Thank you very much for your comment and the nice words. I am glad that you liked the video and the structure. I don't use social media, they distract me from the work, and believe me producing videos like this require a huge amount of time. If you want to see updates from me on the projects I am building check my community tab here on RUclips.