Skip to content

Silent18Killer/Python-Ping-Pong-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python-Ping-Pong-Game

This is Project Demo

Projects Details

This is a Python Ping Pong Game.

  • ball.py -> This file is responsible for creating the game ball.
  • scoreboard.py -> It handles the creation of the scoreboard, keeping track of each player’s score.
  • paddle.py -> This file creates two paddles, which can move up and down. These paddles are essential for gameplay.
  • line.py -> It generates the center line on the table, separating the two players.
  • main.py -> The main file that orchestrates everything. When you run this file, it opens a window where you can play the game.

How to Use

In the above code, after illustrating the outlook of the screen with paddles and ball, we will first initialize the score of both the players, that is, Zero. Then, we will display the score on the screen, which will increase with the opposite player missing the strike. We will then implement the functions for moving the paddle vertically. We will bind the keys for each function, that is, for "Left Paddle": "W" for "Up" and "S" for "Down", for "Right Paddle": "Up key" for "Up" and "Down key" for "Down". Then, we will initiate how the ball and striking of the paddle will work, as if the ball hit the paddle, it will go for the opposite player, but if the paddle missed the ball, then the ball will hit the border, and the opposite player will get the score. If the code is correct and no error is found, the screen of Ping Pong Game will pop up after running the code, and the players can play. The ball will first go for the right player.

Programming languages used:-

python

Developer

@Silent18Killer