A Pong clone game tutorial for beginners using Python 3.
⭐️Course contents ⭐️
⌨️ (00:00) Part I: Introduction and the basic window setup
Code:
⌨️ (03:32) Part II: Add game objects to the screen (Paddles and Ball)
Code:
⌨️ (09:15) Part III: Moving the Paddles
Code:
⌨️ (15:06) Part IV: Moving the ball
Code:
⌨️ (24:10) Part V: Colliding with the Paddles
Code:
⌨️ (30:47) Part VI: Scoring
Code:
⌨️ (37:57) Part VII: Adding Sound
Code:
🔈 Sound file:
💻 Finished Code:
Tutorial from Christian Thompson. Check out his YouTube channel:
—
Learn to code for free and get a developer job:
Read hundreds of articles on programming:
And subscribe for new videos on technology every day:
Nguồn: https://rantbit.com
Xem thêm bài viết khác: https://rantbit.com/game/
Thanks to freeCodeCamp.org for sharing this and supporting free coding education worldwide! Check out the links in the description to my YouTube channel and blog for more coding tutorials. Keep on codin'!
Hay man I need some help because I cant get this invalid syntax on the if ball.xcor () > 390: so that's what I typed
I did the coding and it was fun and great! Only issue, it took me an hour and my file disappeared. Now I am sad and have to do it all again.
So now can you do a tutorial video on how to create GTA5?
For me the ball is going way too fast.
even copy /pasting your code into pyCharm gives me the black window only, the paddle doesn't show up. Any idea why?
Please I'm confused.. How did you get import turtle?
why do my pong ball move so fast? its like x3 of the speed shown in ur video help :))
When I start the code after making it so it should bounce off the wall, the ball just keeps on going against the wall and doesn't change direction. Can anyone help pls?
wn.onkeypress(paddle_a_down, "s")
NameError: name 'paddle_a_down' is not defined
please help
which IDE should i use for this?
please tell me how you can donload python 3 i beg you please
Finished. I never thought I could code a game until I watched this video. Thank you, Christian!
1 question, like if anybody knows bout curses, we havta download it soo, so we have to download turtle
sqaures doesent work for me 🙁
I have made the ball speed 0 but ball is moving very fast
The ball goes way to fast on the screen how can I change the speed? Right now, my ball.speed(0) is this how can I slow it down?
print("Im currently at 7:25")
The score does not seem to be visible
Anything I could have done wrong
I am not able to get the paddle on my screen.Can you help me out?
Here's the code
import turtle
wn = turtle.Screen()
wn.title("Pong")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)
score_a = 0
score_b = 0
paddle_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)
Make p***s painters
😀 it worked!!!!!! I FIXED STUFF AND SOMETIMS I WAS 1 STEP AHEAD!!!!!! 😀 I THINK THIS IS AWESOME!!!!!!!!!!!!!
how do you stop the paddles from going offscreen?
winsound.PlaySound("C:/Users/put user name here/Downloads/bounce.wav", winsound.SND_ASYNC)
im happy with mah black box
I am using Thonny to do this and when i reached the bit were the score is re written for Player B for me it does not write anything and just gives the point to player A. any suggestions?
Edit: I actually got it to work im just bad at pong thats why XD amazing tutorial btw. You just got a new sub 🙂
nice
I got an error on ball.dx saying that ball is not defined
Instead of doing wasd, you can do the arrow keys, but you have to do capital letters, for example, Up, Down, Left, RIght.
Thanks! This was very helpful!
my ball is stuck, it's moving at the same place for some reason
Can you make a seperate video about collision detection
in part five I keep getting an error _tkinter.TlcError: invalid command name ".!canvas" what does that mean
Hey is there a command to play sound on windows..? Im stuck help sos
which IDE do you use?
sir please promote my channel " Ares Cube" because I very fans your channel
so i tried to do the sound part but instead of the bounce.wav playing, i just got a windows error sound, which is just as good so im happy
module 'turtle' has no attribute 'screen' well that's a problem…
How do I prevent the paddles from going outside the map? Currently when I go with a paddle outside the map the ball speeds up…
The link download doesent work when I downloaded the game the pong went wayyy to fast
Sir my python program is telling that paddle_a_up is not define what should I do
What text editor do you use in the video?? @freecode