|
1 | | -<!--Please do not remove this part--> |
2 | 1 |  |
3 | 2 |  |
4 | | -<p align="center"> |
5 | | -### Lazy Pong |
6 | 3 |
|
7 | | -## 🛠️ Description |
8 | | -<!--Remove the below lines and add yours --> |
9 | | -This is a very simple Pong game made with python. It's so simple it doesnt even keep track of scores |
| 4 | +# Pong Game in Python |
10 | 5 |
|
11 | | -## ⚙️ Languages or Frameworks Used |
12 | | -You need [Python](https://www.python.org/downloads/) to run this script, and also [PyGame](https://www.pygame.org/download.shtml). |
| 6 | +## 🌟 Introduction |
| 7 | +This is a simple implementation of the classic Pong game in Python using the Pygame library. In this game, two players control paddles, trying to bounce a ball back and forth. The goal is to score points by getting the ball past the opponent's paddle. |
13 | 8 |
|
14 | | -## 🌟 How to run |
15 | | -Type this in the terminal |
16 | | -```sh |
17 | | -python pong.py |
| 9 | +Based on the previous version of [Ben Sicat](https://github.com/Ben-Sicat) |
| 10 | + |
| 11 | +## 📝 Prerequisites |
| 12 | +Before running the game, make sure you have [Python](https://www.python.org/downloads/) to run this script, and also [PyGame](https://www.pygame.org/download.shtml). You can install Pygame using pip: |
| 13 | + |
| 14 | +```bash |
| 15 | +pip install pygame |
| 16 | +``` |
| 17 | +## 🎮 How to Play |
| 18 | + |
| 19 | +- Run the script with Python |
| 20 | +- The game window will appear with two paddles and a ball in the middle. |
| 21 | +- Use the arrow keys to control your paddle (Player 1) up and down. |
| 22 | +- The CPU controls the other paddle (Player 2). |
| 23 | +- The game starts when you press any arrow key. The ball will start moving in a random direction. |
| 24 | +- The goal is to bounce the ball past your opponent's paddle and score points. |
| 25 | +- The game continues until one player reaches the specified maximum score. |
| 26 | +- If you win, your name will be displayed as the winner. |
| 27 | + |
| 28 | +## ⚙️ Configuration |
| 29 | +You can configure the game by modifying the script's parameters, such as screen width, screen height, player name, color, frames per second (fps), and maximum score. |
| 30 | + |
| 31 | +```bash |
| 32 | +python pong.py [-h] [-dw WIDTH] [-dh HEIGHT] [-n NAME] [-c COLOR] [--fps FPS] [--max_score MAX_SCORE] |
| 33 | +options: |
| 34 | + -h, --help Show help message and exit |
| 35 | + -dw WIDTH, --width WIDTH Width of the display (dflt 320) |
| 36 | + -dh HEIGHT, --height HEIGHT Height of the display (dflt 240) |
| 37 | + -n NAME, --name NAME Player name |
| 38 | + -c COLOR, --color COLOR Game color (dflt light grey) |
| 39 | + --fps FPS Framerate (dflt 120) |
| 40 | + --max_score MAX_SCORE Max score to win (dflt 10) |
| 41 | + |
| 42 | +``` |
| 43 | + |
| 44 | +## Color Options |
| 45 | +You can change the color of the game by specifying a color from the below list of available colors: |
| 46 | +``` python |
| 47 | +rgb_colors = { |
| 48 | + "red": (255, 0, 0), |
| 49 | + "green": (0, 255, 0), |
| 50 | + "blue": (0, 0, 255), |
| 51 | + "yellow": (255, 255, 0), |
| 52 | + "purple": (128, 0, 128), |
| 53 | + "orange": (255, 165, 0), |
| 54 | + "pink": (255, 192, 203), |
| 55 | + "cyan": (0, 255, 255), |
| 56 | + "lime": (0, 255, 0), |
| 57 | + "teal": (0, 128, 128), |
| 58 | + "navy": (0, 0, 128), |
| 59 | + "maroon": (128, 0, 0), |
| 60 | + "olive": (128, 128, 0), |
| 61 | + "brown": (165, 42, 42), |
| 62 | + "gray": (128, 128, 128), |
| 63 | + "black": (0, 0, 0), |
| 64 | + "white": (255, 255, 255), |
| 65 | + "silver": (192, 192, 192), |
| 66 | + "gold": (255, 215, 0), |
| 67 | + "violet": (238, 130, 238), |
| 68 | + "indigo": (75, 0, 130), |
| 69 | + "turquoise": (64, 224, 208), |
| 70 | + "lavender": (230, 230, 250), |
| 71 | + "crimson": (220, 20, 60), |
| 72 | + "coral": (255, 127, 80), |
| 73 | + "skyblue": (135, 206, 235), |
| 74 | + "magenta": (255, 0, 255), |
| 75 | + "chartreuse": (127, 255, 0), |
| 76 | + "sienna": (160, 82, 45), |
| 77 | + "plum": (221, 160, 221), |
| 78 | + "khaki": (240, 230, 140), |
| 79 | + "darkgreen": (0, 100, 0), |
| 80 | + "deepskyblue": (0, 191, 255), |
| 81 | + "limegreen": (50, 205, 50), |
| 82 | + "tomato": (255, 99, 71), |
| 83 | + "salmon": (250, 128, 114), |
| 84 | + "goldrod": (218, 165, 32), |
| 85 | + "darkorchid": (153, 50, 204), |
| 86 | + "peru": (205, 133, 63), |
| 87 | + "orchid": (218, 112, 214), |
| 88 | + "royalblue": (65, 105, 225), |
| 89 | + "indianred": (205, 92, 92), |
| 90 | + "yellowgreen": (154, 205, 50), |
| 91 | + "lightgrey" : (200, 200, 200) |
| 92 | +} |
18 | 93 | ``` |
| 94 | +The default is **lightgrey** You can choose from colors like red, green, blue, yellow, and more. |
19 | 95 |
|
20 | | -## 📺 Demo |
21 | | -<p align="center"> |
22 | | -<img src = "https://github.com/ndleah/python-mini-project/blob/main/IMG/pong.png"> |
| 96 | +## 😄 Enjoy the Game! |
| 97 | +Have fun playing this simple Pong game. Feel free to customize it and make it your own. If you encounter any issues, please refer to the script's comments and logs for troubleshooting. |
23 | 98 |
|
| 99 | +## 🤖 Author |
| 100 | +[dar8900](https://github.com/dar8900) |
24 | 101 |
|
25 | | -## 🤖 Author |
26 | | -<!--Remove the below lines and add yours --> |
27 | | -[Ben Sicat](https://github.com/Ben-Sicat) |
28 | 102 |
|
0 commit comments