42 Comments



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/

Author

meeylandofficial@gmail.com

42 thoughts on “Python Game Tutorial: Pong

  1. 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'!

  2. 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

  3. 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.

  4. even copy /pasting your code into pyCharm gives me the black window only, the paddle doesn't show up. Any idea why?

  5. 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?

  6. 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?

  7. 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)

  8. 😀 it worked!!!!!! I FIXED STUFF AND SOMETIMS I WAS 1 STEP AHEAD!!!!!! 😀 I THINK THIS IS AWESOME!!!!!!!!!!!!!

  9. 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 🙂

  10. Instead of doing wasd, you can do the arrow keys, but you have to do capital letters, for example, Up, Down, Left, RIght.

  11. in part five I keep getting an error _tkinter.TlcError: invalid command name ".!canvas" what does that mean

  12. 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

  13. 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…

Leave a Reply

Your email address will not be published. Required fields are marked *