Pong in Python! Part 3 - Collision Detection, Game Over and Restarting

preview_player
Показать описание
This video is part three in a five part series rebuilding the classic video game PONG from start to finish using Python and Pygame! This series covers everything from absolute scratch to a fully functioning game start to finish and includes tips and ideas for creating some customization and potentially an even more advanced version of the game!

In episode one we define the game board size, draw the rectangles to act as the player and the computer paddles, then draw the ball onto the screen, and write the programming for the player to move up and down with keyboard keys!

In episode two of the series we write the code for AI movement of the opposing paddle as well as handle the ball's movement to bounce off of walls using collision detection and setting speeds to vary the difficulty and ability of your opponent!

In episode three of the series we create actual collision detection between the ball and the player and computer's paddles and make the ball bounce the opposite direction on collision but then if it hits the left or right walls we create the code for game over tracking!

Episode four of the series handles restarting the game after game over conditions have been met, and resetting everything on the board back to starting positions, as well as tracking score during the game based on how many times the ball has ricocheted!

Episode five is the final part of the series and handles code for a color changing ball that randomly picks a color to change to every bounce, as well as incrementing the speed to increase as the scores get higher so the game gets progressively more difficult as it goes on!

This entire series is meant to help with general python skills as well as be a fun game building exercise. We cover drawing buttons, labels, text and all kinds of widgets and shapes into the Pygame GUI, defining player controls from clicking the mouse or exit button to typing specific keystrokes!

If you found this useful be sure to check out the channel for a ton of additional python and coding tutorials and practice! Thanks for watching and good luck with your code!

check out the channel:
Рекомендации по теме
Комментарии
Автор

Why not use else statement instead of if game_over ?

xanderpixel