- Two Player Mode: Control the left paddle using
W
andS
keys and the right paddle using theUp
andDown
arrow keys. - Scoreboard: Tracks the score for both players.
- Ball Mechanics: The ball bounces off the walls and paddles, and the speed increases slightly every time a player hits the ball.
- Simple Graphics: The game uses Turtle graphics to render the paddles, ball, and scoreboard.
This is the main file that runs the game. It initializes the screen, the paddles, the ball, and the scoreboard. It also sets up the game loop and handles user input for paddle movement.
This file defines the Ball
class, which controls the movement of the ball, its reflection off the walls, and its interactions with the paddles. When the ball goes past a paddle, the score is updated, and the ball resets to the center.
This file defines the ScoreBoard
class, which handles the scoring system. It updates the score every time a player scores a point and displays the scores on the screen.
This file defines the Paddles
class, which creates and controls the paddles for both players. It allows the paddles to move up and down based on player input.
- Run
main.py
. - Use the W and S keys to control the left paddle.
- Use the Up and Down arrow keys to control the right paddle.
- The game ends when a player reaches a pre-set score (you can modify this in the code).
- The ball speeds up after each bounce.
- Python 3.x
- Turtle Graphics Library (comes pre-installed with Python)
- Make sure you have Python 3.x installed on your computer.
- Download all the files.
- Run
main.py
from your terminal or an IDE
Enjoy the game!