Name: pong.py
Description: My simple implementation of classic Pong.
Author:
- Code: jelmore
- Fonts: https://github.com/TheRobotFactory/EightBit-Atari-Fonts
- WAVs:
- wall/paddle collision: https://freesound.org/people/NoiseCollector/
- score/out-of-bounds: https://freesound.org/people/Fupicat/
- start game: https://freesound.org/people/iut_Paris8/
Usage:
- Clone repository:
git clone https://github.com/jerryrelmore/1-pong-23.git
cd 1-pong-23/src
- Either setup a virtual env or install requirements as a system package, e.g.:
pip3 install -r ../requirements.txt
- Execute:
python3 pong.py
- Player 1 uses
w
ands
to move up or down, respectively. - Player 2 uses
UP
andDOWN
arrows for the same. - Press
r
to restart the game at any time. - Press
q
orESC
to quit. - First player to 11 points wins. Enjoy!
#TODO:
Implement Game Over screen.Implement ability to restart during the game.End game when first player scores 11 points.- Add jingle for winner.
- Add slight pause before ball moves after restart (maybe leverage self._first_run bool?).
- Add ability to pass in preferred screen size as CLI arg.
- ???
- Code clean-up
#BUGFIX:
- If upper-left pixel of ball has a lower value than upper left pixel of the paddle, a collision isn't detected.
- Ball can get "stuck" on paddle and bounce quickly back and forth then end up going behind the capturing paddle. NOTE: May actually consider this a feature, not a bug.