Learn Python by Building Five Games - Full Course

Поділитися
Вставка
  • Опубліковано 5 лис 2019
  • Learn Python in this full tutorial course for beginners. This course takes a project-based approach. We have collected five great Python game tutorials together so you can learn Python while building five games. If you learn best by doing, this is the course for you.
    🎥 Learn Python syntax in our other Python course: • Learn Python - Full Co...
    🎥 Learn Pygame: • Pygame Tutorial for Be...
    ⭐️ Course Contents ⭐️
    ⌨️ (0:01:18) Pong
    🔈 Sound file: christianthompson.com/sites/de...
    💻 Code: christianthompson.com/sites/de...
    🔗 Tutorial from Christian Thompson. Channel: / @tokyoedtech
    ⌨️ (0:45:36) Snake
    💻 Code: pastebin.com/embed_js/jB6k06hG
    🔗 Tutorial from Tech with Tim. Channel: / @techwithtim
    ⌨️ (1:34:57) Connect Four
    💻 Code: github.com/KeithGalli/Connect...
    🔗 Tutorial from Keith Galli. Channel: ‪@KeithGalli‬
    ⌨️ (2:42:36) Tetris
    💻 Starter File: pastebin.com/embed_js/VztMLjCc
    💻 Full Code: pastebin.com/embed_js/yaWTeF6y
    🔗 Tutorial from Tech with Tim. Channel: / @techwithtim
    ⌨️ (4:22:12) Online Multiplayer Game
    💻 Code: techwithtim.net/wp-content/up...
    🔗 Tutorial from Tech with Tim. Channel: / @techwithtim
    --
    Learn to code for free and get a developer job: www.freecodecamp.org
    Read hundreds of articles on programming: freecodecamp.org/news
    And subscribe for new videos on technology: ua-cam.com/users/subscription_cent...

КОМЕНТАРІ • 3 тис.

  • @meflea3675
    @meflea3675 4 роки тому +3587

    OK but why are you staring directly at my soul?

    • @chriswild6084
      @chriswild6084 4 роки тому +86

      Does not happen a lot of times but your comment really made me laugh :D

    • @5ervanttechintel_github_io979
      @5ervanttechintel_github_io979 4 роки тому +20

      You're funny, man..

    • @k.santiagodiaz3744
      @k.santiagodiaz3744 4 роки тому +32

      I didn't expect to come across a comment like this. Lol

    • @teebya
      @teebya 4 роки тому

      Works on my VS Code on Windows properly. Try copy/pasting the full code (there is a link in description) and see if that works.

    • @sans2019
      @sans2019 4 роки тому +1

      Lol

  • @sumitpaul1043
    @sumitpaul1043 2 роки тому +102

    This was the most straight-forward Python tutorials I have seen so far. The people are really good at coding and explain things really well! I will definetly recommend this channel to my friend who also wants to learn Python. Thanks again for teaching me and other people Python!

  • @techbot1942
    @techbot1942 2 роки тому +38

    The first tutorial is the best!
    the teacher explains EVERYTHING and advices on the little details we have to focus on.

  • @user-ju6sx2eh4p
    @user-ju6sx2eh4p Рік тому +10

    Just wanted to say thanks to all those involved in creating, editing, and posting this. Tremendously helpful to us new coders. Liked and subscribed!

  • @qqqalo
    @qqqalo 4 роки тому +1835

    Imagine pressing space bar 4 times
    this post was made by TAB gang

    • @salaa23
      @salaa23 4 роки тому +36

      one two three four one two three four

    • @Lg-xt5eh
      @Lg-xt5eh 4 роки тому +30

      *TAB GANG IS THE BEST :>*

    • @IoriKana
      @IoriKana 4 роки тому +4

      you just saved a lot of people's (including me)' time, thank you

    • @VANTABL4CK
      @VANTABL4CK 4 роки тому +12

      *Ctrl + S GANG*

    • @unou588
      @unou588 4 роки тому +15

      Where did the astrophysics student open a Tab for drinks after failing his final? The Space Bar

  • @nintendonerd4822
    @nintendonerd4822 2 роки тому +183

    I am a brand new coder, with no expirience. Finding an actually helpful video has been really difficult, but this one helped out more than I can explain. Thank you so much, just the first program about pong showed me more about game design and code than I ever would have though I would know

    • @Retown_Locals
      @Retown_Locals Рік тому +1

      me too😃

    • @MrSHAMLAN911
      @MrSHAMLAN911 Рік тому

      came from a material engineer background, honestly i believe that we won't survive if we don't pick up coding

    • @alejandroramirez-ih7jv
      @alejandroramirez-ih7jv Рік тому +1

      @@MrSHAMLAN911 what do you mean you wont survive

  • @Formallyknownashandle
    @Formallyknownashandle 2 роки тому +5

    I am already far less frustrated with you than I was with another video from the same channel. Good pacing. Good explanation. And you aren't jumping all over the place in a way that is confusing. Thank you!

  • @phoenixyt124
    @phoenixyt124 2 роки тому +817

    The first game was sooo nice to remake myself for practice!! Had tons of fun!

    • @info659
      @info659 2 роки тому +5

      Hey how to test your program

    • @phoenixyt124
      @phoenixyt124 2 роки тому +1

      @@info659 what do you mean? If you use pycharm just play your program, than you can see if it works.

    • @info659
      @info659 2 роки тому +4

      @@phoenixyt124 but how to play your program?

    • @phoenixyt124
      @phoenixyt124 2 роки тому +4

      @@info659 just click run in the top right corner. the green arrow.

    • @debil11c51
      @debil11c51 2 роки тому +3

      @@info659 or f5

  • @bijayanath9308
    @bijayanath9308 4 роки тому +4194

    Instructions unclear accidentally made Gta 7

  • @thefierceninja2557
    @thefierceninja2557 3 роки тому +350

    just finished Pong and added an extra feature, when the ball hits the paddle it increases speed by multiplying dx and dy by 1.03, it gives a really smooth increase in difficulty as the ball bounces and makes the game more interesting.
    to apply this simply add "ball.dx *= 1.03" and "ball.dy *= 1.03" at the end of both paddle collision functions.
    ps. thanks free code camp for helping me find easier to interpret information on how to code, if I didn't see this and python for beginners or something like it, I would still be spending my nights confused or playing videogames instead of learning something useful.

    • @MateusFerreira-on3kp
      @MateusFerreira-on3kp 3 роки тому +6

      I'm doing the same thing, great minds think alike I guess

    • @MaveTheRedd
      @MaveTheRedd 2 роки тому +4

      I made it so that paddle a decreases paddle b decreases

    • @MaveTheRedd
      @MaveTheRedd 2 роки тому +3

      b increase i mean

    • @leulgetachew6188
      @leulgetachew6188 2 роки тому +2

      is there a was to make it reset the speed after you score?

    • @leulgetachew6188
      @leulgetachew6188 2 роки тому +1

      @@MateusFerreira-on3kp is there a was to make it reset the speed after you score?

  • @MrKulkow
    @MrKulkow 2 роки тому +3

    Thank you so much! I’m just starting with Python and VS and this tutorial is so helpful! ❤️🙏🏻

  • @chenko8374
    @chenko8374 2 роки тому +10

    I created my first app by doing what he did, didn't do nothing by myself but it's the best way of learning because the next time I'll at least have the concept. Learning practically is the best way.

  • @cprn.
    @cprn. 4 роки тому +34

    Yay, 1st guy! I remember you from the SameGame labs video! That was quite a good one, I still recommend it to people who want to get the basics of game design (and squeeze in MVC + TDD).

    • @user-pc6bs4bf2m
      @user-pc6bs4bf2m 3 роки тому

      hey, could you please post the link ? I need to squeeze in MVC so bad :(

  • @chriss2295
    @chriss2295 4 роки тому +136

    This is an EXCELLENT test to see if you are “learn by doing” type of learner. New programmers can just dive in. Quite a bit of it will stick, even if it doesn’t make much sense right now.

    • @foreversleepy4379
      @foreversleepy4379 2 роки тому +10

      You should be learning the basics and how to program before you even think about making games. Game programming isn't for beginners.

    • @EnthyMC
      @EnthyMC 2 роки тому

      f

    • @sebiporini
      @sebiporini 2 роки тому +2

      Thanks. That has really encouraged me.

    • @henriquedelben
      @henriquedelben 2 роки тому +1

      My man, i am a beginner and, i have a doubt about "how to learn", like I don't have any idea how to build a tetris game for example, or a project from "Top Python Projects for beginners" like I found on internet, picking the tetris example, for I to be able to learn how to build it, should I watch the tutorial, get some notes and try to rebuild it or idk, maybe I am doing wrong, because I feel like it's just a really giant universe that it's not like a linear path where i can say: "well, today i'm going to study this so I can follow this study planning so by the end of the month I will be able to build a tetris game because I will know all the necessary things, it's not like math, if you know what I mean

    • @hishamkidwai4928
      @hishamkidwai4928 10 місяців тому

      @@henriquedelben It's been a year, how did you start your first project and how's the coding journey been? I've in similar shoes as you were lol

  • @jonasvandenbroeck72
    @jonasvandenbroeck72 2 роки тому +53

    My man: I can't express enough gratitude on how you explain everything! Without a doubt one of the best courses. You teached me the basics under 24h + you made me want to dive deeper instead of falling a sleep.. THANKS THANKS THANKS!!

  • @ss0ldd
    @ss0ldd Рік тому

    man, you have the best explanations of making games! thank you all, it was nice to learn for your videos!

  • @YoutubeSucksEggs
    @YoutubeSucksEggs 4 роки тому +33

    That first Pong tutorial is fantastic, thank you!

  • @carlyb7061
    @carlyb7061 4 роки тому +4

    It's cool to see this video. Despite me not needing to watch this video due to me having created dozens of games in pygame over the years, it is cool to see you guys helping newcomers to what I had to learn from books and online documentation. ✌️

    • @varunchauhan5971
      @varunchauhan5971 4 роки тому

      What was the best source for you? Any particular book or documentation you can tell me?

  • @Thefarukcan
    @Thefarukcan Рік тому +1

    Allready 5 min in, I loved it. Very honest and calm. Thank you so much for the help 😌

  • @ScaerieTale
    @ScaerieTale 2 роки тому +83

    At 9:37 you talk about the importance of testing as you go. This is SO true! At one point I accidentally put paddles after main loop, and it broke everything haha. Took me five minutes to realize what I'd done, but I learned from it, so it worked out :)

    • @george9717
      @george9717 2 роки тому

      same!

    • @youssefamr8073
      @youssefamr8073 Рік тому

      Can i ask you a question. Shouldn’t the paddles be in the main loop ? I don’t understand how it checks if we move up and down without going twice

    • @ThaoPham-pe5vj
      @ThaoPham-pe5vj Рік тому

      @@youssefamr8073 same problem with u, i just can move up and down once!!!

    • @ThaoPham-pe5vj
      @ThaoPham-pe5vj Рік тому

      oh i fixed it, '+=' but i typed '=+' :)))

    • @fungaragun8065
      @fungaragun8065 Рік тому +1

      @@youssefamr8073 tbh
      you should make paddle out of the main game loop(or else it will just make a paddle everytime the funtion in while run again, causing 2 turtle with same name appearing, and making it break)
      but you should check the keybind in the main loop, because if you don't it will only check when the python run through the funtion, which is probably 0.0001 sec or idk, so you need to put it in the while funtion to keep it always checking your keybind
      and you should just make the define paddle_a movement outside of the main game loop, or else it would define paddle_a movement every time the funtion inside while run again(probably like 0.0001 sec)

  • @butyoudidnt4387
    @butyoudidnt4387 3 роки тому +6

    Thank you so much for making this FREE 6 HOURS AND 45 MINUTES COURSE!! I'm so amazed by this holy smokes!

  • @marcosorbona4047
    @marcosorbona4047 4 роки тому +16

    Omg the pong game is amazing! So satisfying as a beginner!!

  • @M5J72XrtvEa24XteAIdNGA
    @M5J72XrtvEa24XteAIdNGA 2 роки тому

    19:20
    line 76, in
    Ball.setx(Ball.xcor+Ball.dx)
    TypeError: unsupported operand type(s) for +: 'method' and 'int'

  • @jivi8213
    @jivi8213 2 роки тому +3

    The ping tutorial was amazing, I changed the colours up and it looked amazing

  • @sancolaelh5809
    @sancolaelh5809 4 роки тому +29

    I am Really really surprised i just began searching for i python game courses i opened youtube and this video showed up.
    Thank you so much FCC

  • @higgo86
    @higgo86 3 роки тому +26

    Learn by doing!! Thank you so much. 5 mins in and have learned more than a 6 week course for beginners

    • @vagifasadov4660
      @vagifasadov4660 2 роки тому +1

      for real?

    • @piantoart2199
      @piantoart2199 2 роки тому

      @@vagifasadov4660 i think yes for real.. sometimes courses for beginners learn you basics too much that you just get bored and you feel like 'where is the goal of all of this ?' but with this course you really know what is the goal of what it is happening

    • @vagifasadov4660
      @vagifasadov4660 2 роки тому

      @@piantoart2199 do u know anything like this for C language?

    • @piantoart2199
      @piantoart2199 2 роки тому

      @@vagifasadov4660 No i am still with python

    • @jcwynn4075
      @jcwynn4075 2 роки тому

      5 minutes in and he hasn't explained anything. It's just copy what I type. No explanation of what each function does or how it works so you can do it on your own. Really not learning or understanding anything

  • @ljubicakovacevic5047
    @ljubicakovacevic5047 2 роки тому +2

    Thank you so much. Just made pong, you've explained it so well.

  • @ArtHoundStudio
    @ArtHoundStudio Рік тому +1

    Thanks man!! This was great! I learned so much about game making!

  • @johnjohnson393
    @johnjohnson393 4 роки тому +11

    Thank you so much just when I need the most. Programming for life. 💸💸🚀🚀😄

  • @sethattun7196
    @sethattun7196 4 роки тому +27

    For those getting problems when following directly along with the pong tutorial, it appears that the shapesize function has changed since the version used in the tutorial. The new syntax is just paddle_a.shapesize(5, 1)

    • @theparrot271
      @theparrot271 4 роки тому

      thanks :)

    • @cdante13h
      @cdante13h 4 роки тому +2

      I’m getting an error saying there’s an error on the wn = turtle.Screen() like
      And that there is no display name and now $DISPLAY environment variable.

    • @fabriziobandiera6648
      @fabriziobandiera6648 4 роки тому +1

      @@cdante13h Hi, me too I'm using Python 3.6.9 and all the wm = blablabla are Attribute Errors... maybe the syntax has changed ?!?

    • @cdante13h
      @cdante13h 4 роки тому +2

      Fabrizio Bandiera I found out I was getting that error because not a lot of python 3 ide’s natively support the turtle package yet. I downloaded pycharm and ran it on there and I didn’t have much problem.

    • @fabriziobandiera6648
      @fabriziobandiera6648 4 роки тому +1

      @@cdante13h Thank You, I've never tried PyCharm at the mo I'm using VSC which is very user friendly :)
      I have another question: since I use linux and I have got 4 versions of Python installed, I would like to install for example the pygame package in my usr/bin/python3.8 and I've tried many times but I can only install the packages in usr/bin/python3 do you know if there's any way to do this ? Cheers

  • @MisterSocke
    @MisterSocke Рік тому +77

    Timestamp:
    1:20 Pong
    45:38 Snake
    1:35:05 Connect four
    2:42:46 Tetris
    4:22:28 Multiplayer Game

  • @bwknowles98
    @bwknowles98 2 роки тому +9

    You can smooth the movement of the ball in the pong tutorial with wn.tracer(1), but it will slow the ball animation down greatly.

  • @pranishkhadgi2723
    @pranishkhadgi2723 4 роки тому +25

    26:53
    on line 95, if you find the line difficult you can change the line in simpler to understand like:
    if ball.xcor() > 350 and (paddle_b.ycor() + 40 > ball.ycor() > paddle_b.ycor() - 40):
    In the video on line 95, after 'and', the comparison (ball.ycor() < paddle_b.ycor() + 40 and ball.ycor() > paddle_b.ycor() - 40) is same as (paddle_b.ycor() + 40 > ball.ycor() > paddle_b.ycor() - 40), but the 2nd one is easy to read/understand.
    Likewise, at 29:15, you can change (ball.xcor() > 340 and ball.xcor() < 350) to (340 < ball.xcor() < 350)
    so the overall command would look like,
    if (340 < ball.xcor() < 350) and (paddle_b.ycor() + 40 > ball.ycor() > paddle_b.ycor() - 40):

    • @anidea8012
      @anidea8012 4 роки тому +1

      I still struggle to understand that line

    • @pranishkhadgi2723
      @pranishkhadgi2723 4 роки тому +6

      @@anidea8012
      I'll try to explain the following code:
      if (340 < ball.xcor() < 350) and (paddle_b.ycor() + 40 > ball.ycor() > paddle_b.ycor() - 40):
      **Note: The above code is modified by me, in the video at 29:30, the original code is:
      if (ball.xcor() > 340 and ball.xcor() < 350) and (ball.ycor() < paddle_b.ycor() + 40 and ball.ycor() > paddle_b.ycor() - 40)
      Here after 'if', it's written as:
      (340 < ball.xcor() < 350)
      The above code means, the x-coordinate of the ball here represented by 'ball.xcor()' should be greater than 340 and less than 350, meaning it should be between 340 and 350. In the video, it is written as:
      (ball.xcor() > 340 and ball.xcor() < 350)
      which is the same thing, meaning the ball.xcor() should be greater than 340 and ball.xcor() should be less than 350.
      On the other code, after 'and', it is written as:
      (paddle_b.ycor() + 40 > ball.ycor() > paddle_b.ycor() - 40)
      This means that the 'ball.ycor()' should be between 'paddle_b.ycor() + 40' and 'paddle_b.ycor() - 40'
      In the video, it is written as:
      (ball.ycor() < paddle_b.ycor() + 40 and ball.ycor() > paddle_b.ycor() - 40)
      which is the same thing.
      You may wonder how that 40 came. we know the height of the paddle is 100, meaning +50 up and -50 down, but the height of the ball is 20, meaning +10 up and -10 down. So, if we subtract 10 by 50, we get 40.
      Hope this clears it up.

    • @hjmhfm
      @hjmhfm 4 роки тому +4

      @@pranishkhadgi2723 thx men, this helped me. had trouble witht he collision

    • @pranishkhadgi2723
      @pranishkhadgi2723 4 роки тому +1

      @@hjmhfm Glad it helped

    • @hadjer9958
      @hadjer9958 2 роки тому

      @@pranishkhadgi2723 thank you sm

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 4 роки тому +130

    This is great! When i was in college I built a simple game too, but didn't have any options to get a job on python where i live so I'm a php guy...

    • @soumadip_skyy_banerjee
      @soumadip_skyy_banerjee 4 роки тому +2

      feel ya bruh

    • @ProgrammingwithPeter
      @ProgrammingwithPeter 4 роки тому

      @A khan what do you need help with?

    • @DailyIntern
      @DailyIntern 4 роки тому +4

      Then teach us PHP brother

    • @ProgrammingwithPeter
      @ProgrammingwithPeter 4 роки тому +9

      @@DailyIntern Because of the work, I can't start tutorial series that teaches languages basics, I build projects with different technologies(Laravel and vuejs at the moment). Because on real world at jobs, you are not going to write plain PHP anymore so, taking another courses(are many already on youtube) for the basics and building projects with me will be more helpful!

    • @EvenTheDogAgrees
      @EvenTheDogAgrees 4 роки тому +1

      Condolences, man... ;)

  • @Hetalia5294
    @Hetalia5294 Рік тому

    Tutorials have been really nice to practice programming while getting free games. I ended up using a different tutorial on the channel for a snake game and had fun choosing pictures and sound effects for the games

  • @Gh0st.5M
    @Gh0st.5M 2 роки тому +1

    Great video and tutorial! thanks for your time and efforts!

  • @laserasia4601
    @laserasia4601 4 роки тому +580

    who's making a game in lockdown
    damn!
    its me.

    • @laserasia4601
      @laserasia4601 4 роки тому +5

      follow me on avakin life
      my name is:
      likemeh profile

    • @mistermomo2904
      @mistermomo2904 4 роки тому +11

      nooooo im making a game outside of lockdown, right in front of my local covid hotspot

    • @laserasia4601
      @laserasia4601 4 роки тому +2

      @@mistermomo2904 ohk

    • @mistermomo2904
      @mistermomo2904 4 роки тому +3

      Laser Asia 😅

    • @laserasia4601
      @laserasia4601 4 роки тому

      @@mistermomo2904 what happened?

  • @MarceloFernandez-bb9tb
    @MarceloFernandez-bb9tb 4 роки тому +11

    Tnks..For more videos like this, cheers from Argentina!

  • @SephPlayz
    @SephPlayz 2 роки тому +2

    The first tutorial is absolutely fantastic!

  • @Misbóbr
    @Misbóbr 2 роки тому

    Thanks now i get if i did not find u i could never make objects Ur a legend this is totally worth a sub😉👌👍keep up great vids!

  • @dennisvanmierlo
    @dennisvanmierlo 2 роки тому +39

    The tutorials give a great insight in how to code in Python. I do have one big comment on these tutorials. Always use readable and understandable names for variables, functions, etc. So not 'w' but 'width' or even better 'windowWidth'. Don't cheap out on this. The IDE's these days do a great job with intellisense for this. Solid and readable code is sooo important in order to deliver great code.

  • @haotruongtri4727
    @haotruongtri4727 Рік тому +87

    Only for Pong and Snake, will be updated:
    Detailed timestamp :
    I : Pong | 1:20
    1:19 Pong (Start)
    3:40 Pong (Main game loop)
    5:17 Pong (Paddle A)
    9:10 Pong (Paddle B)
    9:51 Pong (Ball)
    10:45 Pong (Functions)
    13:08 Pong (Keyboard binding)
    16:47 Pong (Ball xy movement)
    17:43 Pong (Move the ball)
    19:41 Pong (Border checking)
    26:22 Pong (Paddle and ball collisions)
    32:24 Pong (Pen)
    35:24 Pong (Score)
    40:00 Pong (Sounds)
    2 : Snake | 45:38
    45:41 Snake (Start)
    47:20 Snake (Main)
    50:50 Snake (Redraw window)
    51:35 Snake (Draw grid)
    55:48 Snake (Making snake object)
    58:00 Snake (Making snake move)
    58:46 Snake (Keyboard bindings)
    1:09:18 Snake (Draw method)
    1:14:09 Snake (Drawing)
    1:18:30 Snake (Stop move)
    1:20:25 Snake (Snack)
    1:24:06 Snake (Colors)
    1:25:27 Snake (Add lenght to snake when ate snack)
    1:27:31 Snake (Set direction for cube)
    1:28:35 Snake (Generating snack into screen)
    1:29:30 Snake (Check dead if snake hit its body)
    1:30:05 Snake (Display Score)
    1:30:53 Snake (Explaining Reset)
    1:31:42 Snake (Messagebox)
    1:33:33 Snake (Add subject and contents)

  • @MasterofPokemonGing
    @MasterofPokemonGing 2 роки тому +47

    It's not being lazy, this is how a professional programmer should be. Fast and efficient

  • @jasonfelton4482
    @jasonfelton4482 11 місяців тому +6

    The first tutorial for Pong was really well done and easy to understand! Great job Christian!
    Unfortunately, the second tutorial for Snake was not nearly as easy to follow or understand. I was really disappointed after getting at least halfway through and then found out that it wasn't working. (Right around 1:18 in the video.) I assumed I mistyped something and went through every piece of code. What I had typed was identical. Then, I tried going to the source code link and cutting and pasting pieces over what I had typed to see if I could find my error. That still didn't work. Finally, I just cut and pasted the entire source code over mine and it still doesn't work. I don't know if I should give the benefit of the doubt and assume that this worked in an earlier version of Python since the tutorial was from a few years ago. The error was:
    for key in keys:
    TypeError: Iterating over key states is not supported
    I have to admit, I wouldn't recommend this tutorial based on not only the poor explanations, but the fact that it doesn't seem to work as written. This is a course for beginners and I unfortunately don't know that I can troubleshoot this issue. Frustrating.
    Again, not to be all negative --- the first tutorial was great!!
    New information: I searched the error and found someone who seemed to have the same problem with this tutorial. They recommended removing "for key in keys:" completely from the move method in the snake class. This seems to have worked. Cautiously continuing this tutorial...but concerned hahaha

  • @zoltan567
    @zoltan567 4 роки тому +9

    I think this is a great tutorial. I've learned traditional OOP programming with C# Java, JS + web stuff like HTML etc. Know I should learn Python super fast, started learning just the syntax was just more than boring. I do some boring syntax learning than I get back here, and everything falls in place. Thanks, Christian for your effort. I've just read you got into Vuejs. Excellent choice compared to Angular ( I did that as well)

    • @Cimex090
      @Cimex090 2 роки тому

      where and how did you learn traditional OOP programming?

  • @anislfmr9968
    @anislfmr9968 2 роки тому +10

    Hi, excellent tutorial, i wanted to ask if there was a more optimal way to do the Pong game using for example class objects for paddles and the ball for example, thanks.

  • @niroscalfon5219
    @niroscalfon5219 2 роки тому +1

    The first and especally the third were awsome and understandable, I learned a lot from those games

  • @thepremact
    @thepremact 2 роки тому +1

    Great !! Love this tutorial.

  • @OnkarMendhapurkar
    @OnkarMendhapurkar Рік тому +2

    Such a great Tutorial! Just finished Ping Pong game, learned a lot! I also added a new feature in my game, I added some random length collidable blocks which fall at randomly from top and ball speeds up after collision with them. Also adjusted the paddles so that then do not go out of the window.

  • @JohnParavantis
    @JohnParavantis Рік тому +18

    If you want to force the ball to move at a constant speed/frame rate in the PONG game, you may add a time.sleep(1/60) command in the while True: loop, and just play with the ball velocity if you need it to move faster or slower. Great video!

    • @chaosjester6776
      @chaosjester6776 Рік тому +2

      Oh thank goodness I was struggling trying to figure that out. Thanks man

    • @MrEvilHere
      @MrEvilHere Рік тому

      how? xd

    • @claytonyoung1351
      @claytonyoung1351 Рік тому

      Can you provide the code for this?

    • @JohnParavantis
      @JohnParavantis Рік тому

      ​@@claytonyoung1351 I did, in my initial comment: You just need to add a time.sleep(1/60) statement in the while True: main loop. Let me see if I can copy my entire program in my next comment.

    • @JohnParavantis
      @JohnParavantis Рік тому +2

      import turtle
      import time
      import winsound
      wn=turtle.Screen()
      wn.setup(width=800,height=600)
      wn.title("PONG - Modified by John A. Paravantis - September 2022")
      wn.bgcolor("papayawhip")
      wn.tracer(0) # Stop window from updating
      ball_velocity=5
      paddle_velocity=7
      paddle_offset=50
      # Score
      score_a=0
      score_b=0
      # Paddle A
      paddle_a=turtle.Turtle() # Create paddle_a Turtle object
      paddle_a.speed(0) # Max animation speed
      paddle_a.shape("square")
      paddle_a.shapesize(stretch_wid=5,stretch_len=1)
      paddle_a.color("maroon")
      paddle_a.penup()
      paddle_a.goto(-350,0)
      # Paddle B
      paddle_b=turtle.Turtle() # Create paddle_b Turtle object
      paddle_b.speed(0) # Max animation speed
      paddle_b.shape("square")
      paddle_b.shapesize(stretch_wid=5,stretch_len=1)
      paddle_b.color("maroon")
      paddle_b.penup()
      paddle_b.goto(350,0)
      # Ball
      ball=turtle.Turtle()
      ball.speed(0) # Max animation speed
      ball.shape("square")
      ball.color("dodgerblue")
      ball.penup()
      ball.goto(0,0)
      # Ball movement
      ball.dx=ball_velocity # movement by pixels
      ball.dy=ball_velocity
      # Scoring mechanism
      pen=turtle.Turtle()
      pen.speed(0)
      pen.color("red")
      pen.penup()
      pen.hideturtle()
      pen.goto(0,260)
      pen.write("Player A: 0 Player B: 0",align="center",font=("Consolas",16,"normal"))
      # Function
      def paddle_a_up():
      y=paddle_a.ycor()
      y=y+paddle_velocity
      paddle_a.sety(y)
      def paddle_a_down():
      y=paddle_a.ycor()
      y=y-paddle_velocity
      paddle_a.sety(y)
      def paddle_b_up():
      y=paddle_b.ycor()
      y=y+paddle_velocity
      paddle_b.sety(y)
      def paddle_b_down():
      y=paddle_b.ycor()
      y=y-paddle_velocity
      paddle_b.sety(y)
      # Keyboard bindings
      wn.listen()
      wn.onkeypress(paddle_a_up,"w") # Make sure you are in US keyboard
      wn.onkeypress(paddle_a_down,"s")
      wn.onkeypress(paddle_a_up,"W")
      wn.onkeypress(paddle_a_down,"S")
      wn.onkeypress(paddle_b_up,"Up")
      wn.onkeypress(paddle_b_down,"Down")
      # MAIN LOOP
      while True:
      time.sleep(1/60) # Keep frame rate constant
      wn.update()
      # Move the ball

      ball.setx(ball.xcor()+ball.dx)
      ball.sety(ball.ycor()+ball.dy)
      # Check borders

      if ball.ycor()>290:
      ball.sety(290)
      ball.dy=-ball.dy # Reverse direction of movement
      winsound.PlaySound("bounce.wav",winsound.SND_ASYNC)
      if ball.ycor()380:
      ball.goto(0,0)
      ball.dx=-ball.dx # Reverse direction of movement
      score_a=score_a+1
      pen.clear()
      pen.write("Player A: {} Player B: {}".format(score_a,score_b),align="center",font=("Consolas",16,"normal"))
      if ball.xcor()330 and ball.xcor()

  • @liloalbrecht3561
    @liloalbrecht3561 2 роки тому

    how, just how do ytou have the time to make a 6 HOUR video its just amazing props to you man.

  • @henrypai3193
    @henrypai3193 Рік тому

    I barely had to rewatch the pong game. Amazing tutorial!

  • @bafana_mhlamvu
    @bafana_mhlamvu 4 роки тому +34

    Just when I was looking into refreshing my python knowledge, FCC strikes again!

  • @EpicGamerX
    @EpicGamerX 4 роки тому +300

    The first tutorial was so good!

  • @thenameless9087
    @thenameless9087 Рік тому

    I managed to make pong, it was so fun through the mistakes and the success, now gonna go back to the beginner tutorial to learn more

  • @PaoloCondo
    @PaoloCondo Рік тому

    Thank you so much for the video! Super useful

  • @cooperbrahmsteadt5123
    @cooperbrahmsteadt5123 4 роки тому +4

    Pong was the best one because he went through everything slowly and didn’t skip any steps or assume we could just figure some things out

  • @narshah4806
    @narshah4806 4 роки тому +906

    The pong tutorial was great. Christian is an excellent teacher who understands how to teach. He kept hammering home that we should always write a little code to check if it works. The second video with Tim has been pretty horrible. He throws all that advice away and just codes blindly for a long time before explaining anything. I am going to complete the connect 4 tutorial next but the snake one was a huge waste of time. I don't know whats going on and I don't really have much leg to stand on to make this work. Seeing at the Tetris and multiplayer one are also from Tim, I will probably not do those. I was hoping the snake tutorial would teach object oriented programming but it was just a code along with little stopping to explain anything.
    I think one thing I would like from both videos are instructions on how to set up and download all packages. I feel like pure beginners will really trip up on that.

    • @ChampionTarzan
      @ChampionTarzan 4 роки тому +86

      300% agree with you

    • @bobbysingh5666
      @bobbysingh5666 4 роки тому +48

      becuase tim's vids arent for begginers

    • @kurashimataro6174
      @kurashimataro6174 4 роки тому +4

      ohk can you tell me which project template we have to choose to do ping pong game

    • @assaadelhalabi2696
      @assaadelhalabi2696 4 роки тому +10

      Christian has a Snake game tutorial for python too

    • @davyroger3773
      @davyroger3773 4 роки тому +9

      @@bobbysingh5666 The code was broken

  • @ManojSharma-vd9xu
    @ManojSharma-vd9xu 2 роки тому +1

    Thanks a lot 😊. Really a good way to learn python.

  • @same3262
    @same3262 11 місяців тому +1

    i love this, it leads me through the process of actually practicing the language not just learning it! Though i have a question, is it possible to make the computer listen to simultaneous keyboard inputs?

  • @mikaiwakura887
    @mikaiwakura887 4 роки тому +36

    In the Pong game there is a small check you forgot to do
    With this program the paddles can go out of bounds
    This gets fixed with a small if (I tested diff values and 250 is the one that better fits for me)
    def paddle_a_up():
    y = paddle_a.ycor()
    if(y < 250):
    y += 20
    paddle_a.sety(y)
    (y > -250 for paddle_a_down and paddle_b_down)
    Still a 10/10 video :D

    • @eltrcxen3459
      @eltrcxen3459 3 роки тому

      hi, where do i paste this code? and is there anything i need to alter

    • @synthesoul
      @synthesoul 3 роки тому

      @@eltrcxen3459 I wouldn't paste it. Put the if statement right after the def y statement and make sure you tab or space the following code you should have implemented earlier

    • @User-qc7gn
      @User-qc7gn 3 роки тому +1

      i copy paste the pong game it dont works:( the boll is toot fast

    • @mohammedrizin6761
      @mohammedrizin6761 2 роки тому +4

      @@User-qc7gn set dx and dy values to 0.2 instead of 2

    • @iuliiablinova8118
      @iuliiablinova8118 2 роки тому

      @@mohammedrizin6761 thanks 🙏

  • @mateoestradarodriguez
    @mateoestradarodriguez 4 роки тому +9

    Great showcase of the *_pygame_* module, thanks for sharing, a few minor suggestions for Tech With Tim...
    1:22:26 The lambda function here seams completely unnecessary a simple *_in_* expression would suffice:
    *_if (x, y) in positions:_*
    *_continue_*
    *_else:_*
    *_break_*
    1:30:00 The lambda function here seams completely unnecessary a simple *_in_* expression would suffice:
    *_if s.body[x] in s.body[x+1: ]_*
    *_..._*
    1:31:22 The name *_self_* should be replaced with *_snake_* to avoid confusion.

    • @Mwila
      @Mwila 3 роки тому

      underrated comment

    • @louiskariuki6255
      @louiskariuki6255 3 роки тому

      Thanks

    • @ultramadscientist
      @ultramadscientist 2 роки тому

      refactoring lambda expressions is often good practice but using self to refer to the object is both the convention and suggested way to reflexively refer to an object in python when you're defining methods and attributes

  • @human8035
    @human8035 2 роки тому +1

    I really liked the rock, paper, scissors game, because I always wanted to learn how to make an online game, and this was the only clear explanation of how I should do it and why.

  • @cmunozperez
    @cmunozperez 2 роки тому

    the first tutorial is awesome. you learn some neat basics that even allow you to make your own very simple atari-like games. the second, rather than being a tutorial is just some guy making a game.

  • @davidalex684
    @davidalex684 6 місяців тому +5

    Normally I thought python is used for programming artificial intelligence but now is used for game programming, no way. Bro I'm learning python a soon as possible. Who's with me

  • @oceansblue692
    @oceansblue692 4 роки тому +8

    This is a great video, KUDOS!
    You are using built in Functions to program the games.
    For a newbie, how or what is the Best / Fastest way to learn about the Functions, learn that there is a Function exists that can do what is needed?

    • @Zorander2008
      @Zorander2008 4 роки тому

      I also find it helpful to go shopping around for functions that do what I want. Where, you might ask? DuckDuckGo, of course.

  • @muimuhadresh3986
    @muimuhadresh3986 2 роки тому

    thanks so much. helped alot.
    For Pong I also added that the paddles can not go over the window

  • @thanhblue5680
    @thanhblue5680 2 роки тому

    Wow. you have an iconic face of a geek, and I mean it in the most possitive way. You could make an brand from that, start your iconic channel!

  • @youkuya
    @youkuya 4 роки тому +7

    WINDOWS SOUND for Pong bounce : what we were told in the video didn't work for me. I used winsound.PlaySound('bounce.wav', winsound.SND_FILENAME). Use single quotes not doubles. Just using doubles can stop the sound working.

  • @lamedev1342
    @lamedev1342 4 роки тому +12

    Okay, tutorials were good but I really wish Tim had made the functions and classes with us for the snake game, I mean it would have made it easier and he could have also explained why we made the class for each thing. I personally understand a bit of why, but still.

  • @AnyariTanakePL
    @AnyariTanakePL 2 роки тому

    I love this guy! So great tutorial!

  • @noggi1452
    @noggi1452 2 роки тому

    Thank you for the throughout course!

  • @matiasrad_
    @matiasrad_ 3 роки тому +17

    is it just me or the first guy's voice was so nice to listen to while learning

  • @poseidonbrozeus5888
    @poseidonbrozeus5888 4 роки тому +5

    I liked Mike Dane the most and want him here.
    His voice combined with the Nasa shirt makes me ready to learn.

  • @sedeyoung
    @sedeyoung Рік тому

    Such an incredible UA-cam channel!

  • @TBruce1380
    @TBruce1380 3 роки тому

    Learned a lot today!! Thanks!!

  • @mitschcrafter6766
    @mitschcrafter6766 3 роки тому +715

    iam actually just here because i forgot the command to open the visual console.

    • @-leapplayz-4684
      @-leapplayz-4684 3 роки тому +17

      Open a folder in file explorer
      Shift rightclick and select open with power shell window then type code . And it will open vs code in that folder

    • @mitschcrafter6766
      @mitschcrafter6766 3 роки тому +17

      @@-leapplayz-4684 thanks. That's not what I meant though. I mean the thing that let's you see the game when you press play in python. Alright found it.

    • @weegoprints
      @weegoprints 3 роки тому +2

      @@mitschcrafter6766 how do you open it?

    • @mitschcrafter6766
      @mitschcrafter6766 3 роки тому +4

      @@weegoprints its at the beginning of the video. just look trough.

    • @abdellatif.x8127
      @abdellatif.x8127 3 роки тому +2

      Hhhhh lol 😂😂

  • @marcos.a8814
    @marcos.a8814 2 роки тому +108

    00:00 Pong
    45:38 Snake
    1:35:05 Connect Four
    Timestamp: 51:00

  • @adityakareer6803
    @adityakareer6803 3 роки тому +1

    Amazing tutorial I made the ping pong game very easy to understand

  • @immercury8512
    @immercury8512 2 роки тому

    his videos are so simple and fun and i learnt a lot from him eventhough he still lack some python basics 😂 i mean how in the world is a floor number not an integer and who doesn't know that integer division happens using double slash ( // ) and for that flipping problem (3rd game) he could have just used "for r in range(ROW_COUNT - 1 , -1 , -1) in the get_next_open_row function"

  • @reidswan9601
    @reidswan9601 4 роки тому +58

    The guy on pong got a lot of errors that I didn’t get lol edit: it was also a great tutorial. One of the only ones I could follow.

    • @roni5245
      @roni5245 2 роки тому

      He got errors because the turtle module always throws a bunch of errors when you close the window while the programming didn't finish writing. In this case, the program runs infinitely, so it will always throw errors when you close the window.

  • @bkzegyptshin1
    @bkzegyptshin1 2 роки тому +11

    Bro taught me more then any of my teachers did In 4 years

  • @alro7779
    @alro7779 Рік тому +2

    This is the best way to learn... by practicing!!!

  • @htavli
    @htavli Рік тому

    This is a great video! Thanks!

  • @lethal_copra
    @lethal_copra 3 роки тому +5

    great course, Now I finished pong and I added some more for example
    1)the paddles will stay inside the game area
    2) the game ends after one player scores 3 goals
    and the scores will start from 0 - 0
    3) the players know who won the last game
    now I want to add one more thing which is How many times each player has won.
    Thanks

    • @evanangelocampos9323
      @evanangelocampos9323 3 роки тому

      How to make the code that ends the game when one player scores 3 goals bro?

    • @roni5245
      @roni5245 2 роки тому

      @@evanangelocampos9323 In the game loop, check if score_a >= 3 or score_b >= 3. Then if it is, score_a = 0 score_b = 0. If you want to actually end the game when the score reaches 3, just type turtle.bye()

  • @saiakhilkatkam87
    @saiakhilkatkam87 3 роки тому +36

    Title: Learn python by building games
    Video: Learn building games using python

  • @user-fn6gq8gk2o
    @user-fn6gq8gk2o 8 місяців тому +1

    I can say that's the best ever pygame turtorial i've ever seen.
    thanks so much.

  • @Alex_MB
    @Alex_MB 3 роки тому

    Very cool video, thanks!

  • @sigloxxi145
    @sigloxxi145 4 роки тому +3

    Can someone make english subtitles, please? That will be really helpful for non english speakers (Like me, I speak spanish but I cannot understand many words and sentences that the instructor says). The spanish speakers will be really grateful with something like that

  • @Skarzx
    @Skarzx Рік тому +4

    Amazing video, during the code for connect four you asked for suggestions for game to make and i think an RPG game would be an amazing project, as it deals with classes, attributes and can be scalable from easy to complex through multiple videos

    • @vlad_khurs
      @vlad_khurs Рік тому

      Hello, I tried to run pong and it does not work correctly. Do you know where is my mistake?

    • @Skarzx
      @Skarzx Рік тому

      when ever your following a video like this you should test the code every time you add a portion, so if you run across an error you know where it's coming from. It's impossible to guess the issue unless we see your code

    • @vlad_khurs
      @vlad_khurs Рік тому

      @@Skarzx Thanks for the advice. My problem is: I can't move left paddle up using "w". I tried to fix it, but it's useless. My code:
      import turtle
      wn = turtle.Screen()wn.title("Pong")
      wn.bgcolor("black")wn.setup(width=800, height=600)
      wn.tracer(0)
      # Paddle Apaddle_a = turtle.Turtle()
      paddle_a.speed(0)paddle_a.shape("square")
      paddle_a.color("white")paddle_a.shapesize(stretch_wid=5,stretch_len=1)
      paddle_a.penup()paddle_a.goto(-350, 0)
      # Paddle Bpaddle_b = turtle.Turtle()
      paddle_b.speed(0)paddle_b.shape("square")
      paddle_b.color("white")paddle_b.shapesize(stretch_wid=5,stretch_len=1)
      paddle_b.penup()paddle_b.goto(350, 0)
      # Ball
      ball = turtle.Turtle()ball.speed(0)
      ball.shape("square")ball.color("white")
      ball.penup()ball.goto(0, 0)
      # Functions
      def paddle_a_up(): y = paddle_a.ycor()
      y += 20 paddle_a.sety(y)
      # Keyboard bindingswn.listen()
      wn.onkeypress(paddle_a_up, "w")
      # Main game loopwhile True:
      wn.update()

    • @Skarzx
      @Skarzx Рік тому

      You never established the variable paddle_a and what happens when u hit "w". You would add to the Y coordinate

    • @Skarzx
      @Skarzx Рік тому

      # Functions
      def paddle_a_up():
      y = paddle_a.ycor()
      y += 20
      paddle_a.sety(y)

  • @babapanda2000
    @babapanda2000 3 роки тому

    You are a great teacher sir!

  • @hansbrodi1333
    @hansbrodi1333 4 роки тому +55

    I really liked the Pong tutorial, the presenter explains everything nice an slow, step by step with checking each change! Absolutely great!
    Then there is the second tutorial! Snake - I think it is absolutely terrible! I appreciate that you provide a FREE tutorial but I am afraid that this implementation of snake will frustrate a lot of people.
    Ideas for improvement:
    1. Slow it down, go more step by step. Like drawing the grid surface first. (without all the other classes already in the code)
    2. Don't put all functions and classes that are required into the document in the beginning (how am I supposed to learn something setting up such an architecture of classes and functions)
    3. Don't copy paste big chunks into the code and then quickly explain them.
    4. I wanted to learn something about OOP - the tutorial starts out with two classes and a bunch of functions ... why are they there ? how do I figure this out on my own when I want to build something?

    • @casaninchiify
      @casaninchiify 4 роки тому +5

      Hans Brodi absolutely. I was 2 min in the snake tutorial and I quit. He‘s way too fast for a beginner and it lacks structure. Feels like he didn’t prepare for the lesson and improvised on the fly.

    • @harshlahoti8368
      @harshlahoti8368 4 роки тому +3

      You are right, the 1st one was gold

    • @abhayagarwal5097
      @abhayagarwal5097 4 роки тому

      Exactly man

    • @Zousky
      @Zousky 4 роки тому

      Guys, for the pong tutorial, I have to type "onkey()" rather than "onkeypress()". Is it that my python launcher is a older vr or is he teaching python 2?

    • @Zousky
      @Zousky 4 роки тому

      Nobody Cares
      Go to this video’s desc and go to the dude, who made pong, channel. He got a snake tutorial

  • @Ballistic_Missile.
    @Ballistic_Missile. 2 роки тому +7

    For anyone who gets annoyed that the ball goes in the borded at -290 put it at -285 instead it will bounce right off the border like it did at the top. Man im way too proud of figuring that out 😂

    • @Riff.Beatz.
      @Riff.Beatz. 2 роки тому

      Thx thought i was missing a code

  • @ANTheWhizkid
    @ANTheWhizkid 2 роки тому +2

    I´m only really good at excel and I know a bit visual basic. But even though I was using python for the first time, I was able to code along while watching the video (esp. pong was fun!).
    The way you explain is just very good. I like it, when somebody is a bit faster so I can pause anytime, but don´t need to fast forward or so. Really cool!
    Actually I´m just interested in python because I do some 3D stuff in my leisure time and could need it for gaining better control over particle simulations... and I have a bit Interest in machine learning too - yeah nerd factor 1000, I know... I call that fun^^

  • @therabidpancake1
    @therabidpancake1 Рік тому +2

    I would like to see you make a Tile Puzzle type of game where you have to slide the tiles around to get the picture or maybe like a Crossword game .

  • @omaraguayo5843
    @omaraguayo5843 3 роки тому +8

    For those on Windows that were unable to figure out why you got the windows sound try this.
    Right on file -> Properties -> [copy file location] -> Replace Forward slash with Back Splash -> Paste in:
    winsound.PlaySound("[File Location]", winsound.SND_ASYNC)
    For example:
    import winsound
    winsound.PlaySound("C:/Coding/Python/pong/pong/bounce.wav", winsound.SND_ASYNC)
    I hope this is able to help someone!

    • @mistakenoblivion
      @mistakenoblivion 2 роки тому +1

      I was struggling with the sound, as a pure beginner, this helped. Thank you

    • @omaraguayo5843
      @omaraguayo5843 2 роки тому

      @@mistakenoblivion im glad I was able to help a little! 😁

  • @epoc6477
    @epoc6477 Рік тому +6

    The first instructor is really good for beginners. The second guy was impossible to follow along with, so i skipped it. Third one wasn't too bad. Fourth one jumped all over the place making it hard to understand what is going on. I ended up with an error and can't figure out the issue to save my life. Even went back and rewatched the segment up until that point and i have still have no idea what is wrong. Dont even feel like trying the fifth one. The reason i like the first guy so much are the reasons i didn't like the next 3. why would you wait to test the program until its halfway done? why would you not explain the errors you made so i have a better understanding of them and how not to make those same errors? if i just wanted to copy code i would rip some from google. The first guy does an amazing job of explaining exactly what is going on and routinely tested the code after each segment, so if i had an error i could just rewatch a small portion of the video instead of having to rewatch 45 minutes of code trying to find the one place i messed up. to anyone reading this i recommend going to his youtube channel and watching his other tutorials.

  • @simonhedqvistsegelman3805
    @simonhedqvistsegelman3805 3 роки тому +2

    The first one was really good!

  • @cybergamers7781
    @cybergamers7781 2 роки тому

    this is really cool !!!

  • @riode1435
    @riode1435 4 роки тому +3

    Just a disclaimer if at 13:20 your code comes up with the error that screen has no attribution onkeypress this is because you have a different version and instead do just onkey

    • @mohammadzafar7891
      @mohammadzafar7891 4 роки тому

      What about for the sety part. For some reason my program doesnt identify it

    • @mohammadzafar7891
      @mohammadzafar7891 4 роки тому

      Never mind just made a really dumb mistake