A Python library for implementing Pong in Pygame.
Project description
python-pong 
python-pong is a simple Python library for quickly setting up components and games of Pong in Pygame.
Installation
python-pong can be installed from PyPI using pip. Simply run the command python -m pip install python-pong
globally, or in your virtual Python project environment, where python is your current Python distribution.
Usage
The contents of the python-pong libraries packages is shown in the following:
pong.components
Ball.py
class Ball(screen: pygame.Surface, radius: float)
def get_x()
def set_x(x: int)
def get_y()
def set_y(y: int)
def get_radius()
def get_velocity()
def set_velocity(velocity: pygame.Vector2)
def update()
Controller.py
class Controller(screen: pygame.Surface, rectangle: pygame.Rect)
def get_x()
def get_y()
def get_width()
def get_height()
def get_velocity()
def set_velocity(velocity: pygame.Vector2)
def update()
Text.py
class Text(screen: pygame.Surface, coordinates: tuple[float, float]))
def get_text()
def set_text(x: int)
def update()
pong.game
Basic.py
class Basic(
controller_width=1/20,
controller_height=2/3,
player_velocity=None,
ball_velocity=None,
frame_rate=60,
tick_rate=40#
)
pong.utility
colours.py
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
An example of the python-pong library being used to create a game of Pong from the Basic class is shown below:
from pong.game.Basic import Basic
def main():
# Create a Pong game
Basic()
if __name__ == "__main__":
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-pong-1.0.2.tar.gz.
File metadata
- Download URL: python-pong-1.0.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48641ca8b03e9932e5ba6832bb3ea1e59c026d8d7c434028622b9d627f02b8ec
|
|
| MD5 |
395ceed681cd2ecf57b45ec4f074b161
|
|
| BLAKE2b-256 |
3f63910e2b9c516247d6be734c2ca037b421dbdd6f6f6b15da07d82c03d3da78
|
File details
Details for the file python_pong-1.0.2-py3-none-any.whl.
File metadata
- Download URL: python_pong-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4942bbb5225381c4cd75476a2997015041047d0aefe960fce7e404d404a85194
|
|
| MD5 |
5e83116a913d40dcf8bf18d7c204a9e3
|
|
| BLAKE2b-256 |
e9d2f6be183f1cb6810a3bdde15c2e50b359c953164e7997f6ae9578c3c27436
|