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...
OK but why are you staring directly at my soul?
Does not happen a lot of times but your comment really made me laugh :D
You're funny, man..
I didn't expect to come across a comment like this. Lol
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.
Lol
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!
The first tutorial is the best!
the teacher explains EVERYTHING and advices on the little details we have to focus on.
Ong
Just wanted to say thanks to all those involved in creating, editing, and posting this. Tremendously helpful to us new coders. Liked and subscribed!
Imagine pressing space bar 4 times
this post was made by TAB gang
one two three four one two three four
*TAB GANG IS THE BEST :>*
you just saved a lot of people's (including me)' time, thank you
*Ctrl + S GANG*
Where did the astrophysics student open a Tab for drinks after failing his final? The Space Bar
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
me too😃
came from a material engineer background, honestly i believe that we won't survive if we don't pick up coding
@@MrSHAMLAN911 what do you mean you wont survive
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!
The first game was sooo nice to remake myself for practice!! Had tons of fun!
Hey how to test your program
@@info659 what do you mean? If you use pycharm just play your program, than you can see if it works.
@@phoenixyt124 but how to play your program?
@@info659 just click run in the top right corner. the green arrow.
@@info659 or f5
Instructions unclear accidentally made Gta 7
Iam going to release gta 7 :)
LOL
@B D iteration
@@bijayanath9308 don't release it with that name, GTA name is copyrighted, use some other name instead
Then who made mc
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.
I'm doing the same thing, great minds think alike I guess
I made it so that paddle a decreases paddle b decreases
b increase i mean
is there a was to make it reset the speed after you score?
@@MateusFerreira-on3kp is there a was to make it reset the speed after you score?
Thank you so much! I’m just starting with Python and VS and this tutorial is so helpful! ❤️🙏🏻
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.
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).
hey, could you please post the link ? I need to squeeze in MVC so bad :(
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.
You should be learning the basics and how to program before you even think about making games. Game programming isn't for beginners.
f
Thanks. That has really encouraged me.
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
@@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
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!!
man, you have the best explanations of making games! thank you all, it was nice to learn for your videos!
That first Pong tutorial is fantastic, thank you!
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. ✌️
What was the best source for you? Any particular book or documentation you can tell me?
Allready 5 min in, I loved it. Very honest and calm. Thank you so much for the help 😌
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 :)
same!
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
@@youssefamr8073 same problem with u, i just can move up and down once!!!
oh i fixed it, '+=' but i typed '=+' :)))
@@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)
Thank you so much for making this FREE 6 HOURS AND 45 MINUTES COURSE!! I'm so amazed by this holy smokes!
Omg the pong game is amazing! So satisfying as a beginner!!
19:20
line 76, in
Ball.setx(Ball.xcor+Ball.dx)
TypeError: unsupported operand type(s) for +: 'method' and 'int'
The ping tutorial was amazing, I changed the colours up and it looked amazing
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
Google knows everything
Yeah Don't use google
Learn by doing!! Thank you so much. 5 mins in and have learned more than a 6 week course for beginners
for real?
@@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
@@piantoart2199 do u know anything like this for C language?
@@vagifasadov4660 No i am still with python
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
Thank you so much. Just made pong, you've explained it so well.
Thanks man!! This was great! I learned so much about game making!
Thank you so much just when I need the most. Programming for life. 💸💸🚀🚀😄
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)
thanks :)
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.
@@cdante13h Hi, me too I'm using Python 3.6.9 and all the wm = blablabla are Attribute Errors... maybe the syntax has changed ?!?
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.
@@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
Timestamp:
1:20 Pong
45:38 Snake
1:35:05 Connect four
2:42:46 Tetris
4:22:28 Multiplayer Game
thanks dude
Thanks
Very thanks
👍👍 Two thumbs up for you my friend
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.
thank you
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):
I still struggle to understand that line
@@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.
@@pranishkhadgi2723 thx men, this helped me. had trouble witht he collision
@@hjmhfm Glad it helped
@@pranishkhadgi2723 thank you sm
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...
feel ya bruh
@A khan what do you need help with?
Then teach us PHP brother
@@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!
Condolences, man... ;)
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
Great video and tutorial! thanks for your time and efforts!
who's making a game in lockdown
damn!
its me.
follow me on avakin life
my name is:
likemeh profile
nooooo im making a game outside of lockdown, right in front of my local covid hotspot
@@mistermomo2904 ohk
Laser Asia 😅
@@mistermomo2904 what happened?
Tnks..For more videos like this, cheers from Argentina!
The first tutorial is absolutely fantastic!
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!
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.
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)
Thanks!
This is so helpful. Thanks :-)
It's not being lazy, this is how a professional programmer should be. Fast and efficient
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
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)
where and how did you learn traditional OOP programming?
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.
The first and especally the third were awsome and understandable, I learned a lot from those games
Great !! Love this tutorial.
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.
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!
Oh thank goodness I was struggling trying to figure that out. Thanks man
how? xd
Can you provide the code for this?
@@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.
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()
how, just how do ytou have the time to make a 6 HOUR video its just amazing props to you man.
I barely had to rewatch the pong game. Amazing tutorial!
Just when I was looking into refreshing my python knowledge, FCC strikes again!
The first tutorial was so good!
Exactly, so bad
i know right
@xavi hahaha exactly!
@@wesleyfan7286 then you are not a true programmer
the first one was coding and running the second one I had no idea what was happening
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
Thank you so much for the video! Super useful
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
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.
300% agree with you
becuase tim's vids arent for begginers
ohk can you tell me which project template we have to choose to do ping pong game
Christian has a Snake game tutorial for python too
@@bobbysingh5666 The code was broken
Thanks a lot 😊. Really a good way to learn python.
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?
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
hi, where do i paste this code? and is there anything i need to alter
@@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
i copy paste the pong game it dont works:( the boll is toot fast
@@User-qc7gn set dx and dy values to 0.2 instead of 2
@@mohammedrizin6761 thanks 🙏
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.
underrated comment
Thanks
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
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.
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.
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
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?
I also find it helpful to go shopping around for functions that do what I want. Where, you might ask? DuckDuckGo, of course.
thanks so much. helped alot.
For Pong I also added that the paddles can not go over the window
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!
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.
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.
I love this guy! So great tutorial!
Thank you for the throughout course!
is it just me or the first guy's voice was so nice to listen to while learning
I liked Mike Dane the most and want him here.
His voice combined with the Nasa shirt makes me ready to learn.
Such an incredible UA-cam channel!
Learned a lot today!! Thanks!!
iam actually just here because i forgot the command to open the visual console.
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
@@-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.
@@mitschcrafter6766 how do you open it?
@@weegoprints its at the beginning of the video. just look trough.
Hhhhh lol 😂😂
00:00 Pong
45:38 Snake
1:35:05 Connect Four
Timestamp: 51:00
thanks mate
Thank for the stamp
Lmao its in descriptio
Amazing tutorial I made the ping pong game very easy to understand
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"
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.
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.
Bro taught me more then any of my teachers did In 4 years
same
This is the best way to learn... by practicing!!!
This is a great video! Thanks!
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
How to make the code that ends the game when one player scores 3 goals bro?
@@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()
Title: Learn python by building games
Video: Learn building games using python
Both
Depends on the learner
I can say that's the best ever pygame turtorial i've ever seen.
thanks so much.
Very cool video, thanks!
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
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
Hello, I tried to run pong and it does not work correctly. Do you know where is my mistake?
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
@@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()
You never established the variable paddle_a and what happens when u hit "w". You would add to the Y coordinate
# Functions
def paddle_a_up():
y = paddle_a.ycor()
y += 20
paddle_a.sety(y)
You are a great teacher sir!
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?
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.
You are right, the 1st one was gold
Exactly man
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?
Nobody Cares
Go to this video’s desc and go to the dude, who made pong, channel. He got a snake tutorial
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 😂
Thx thought i was missing a code
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^^
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 .
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!
I was struggling with the sound, as a pure beginner, this helped. Thank you
@@mistakenoblivion im glad I was able to help a little! 😁
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.
The first one was really good!
this is really cool !!!
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
What about for the sety part. For some reason my program doesnt identify it
Never mind just made a really dumb mistake