Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robotastic/circuitpython-face-pong
Play Pong using your Face!
https://github.com/robotastic/circuitpython-face-pong
Last synced: 7 days ago
JSON representation
Play Pong using your Face!
- Host: GitHub
- URL: https://github.com/robotastic/circuitpython-face-pong
- Owner: robotastic
- License: mit
- Created: 2022-10-18T02:12:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-18T02:17:01.000Z (about 2 years ago)
- Last Synced: 2024-12-13T23:28:09.262Z (13 days ago)
- Language: Python
- Size: 4.88 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CircuitPython Face Pong
**This is a simple game of Pong... that you play with your face!**
It uses the Useful Sensors Person Detector to find your face and you move back in forth in front of the camera to move to paddle and try to beat the computer.
The game extends the FoamyGuy's CircuitPython [pong game](https://github.com/FoamyGuy/CircuitPython-Badge-One-Player-Pong) to make it work on an RGB Matrix and work with the Person Detector.
### Required Libraries
- [Useful Sensors Person Detector Driver](https://github.com/robotastic/CircuitPython_UsefulSensors_PersonDetector)
- rgbmatrix
- adafruit_display_shapes
- board
- busio
- displayio
- framebufferio### Hardware
It has been tested using:
- [64x64 RGB LED Matrix - 3mm Pitch](https://www.adafruit.com/product/4732)
- [Interstate 75 - RGB LED Matrix Driver](https://shop.pimoroni.com/products/interstate-75?variant=39443584417875)The Interstate 75 is a nice little RGB Driver board from Pimoroni and it is built around the Raspberry PI RP2040 MCU. It can support Arduino and Circuit Python, and has a Stemma QT/Qwiic port built in. To add the sensor, you just have to plug it in.
This should also work with Adafruit's [Matrix Portal](https://www.adafruit.com/product/4745).
The game is broken into two files:
- code.py - Contains the main loop, RGB Matrix setup, and manages high-level game object update function calls.
- pong_helpsers.py - contains helper objects for the game elements. code.py imports, creates, and calls update() on these objects at the appropriate time. The update() functions that are defined in this file control the behavior of the three types of game elements, sensor paddles, auto paddles, and balls. The bottom in this variant of the game is controlled by the data from the sensor. The top paddle is controlled automatically by an algorithm in the update() function. It tries to keep it's center aligned vertically with the ball. The ball moves automatically and changes direction when it collides with a paddle.
## Extend it further
This is a basic game, there is a lot that can be done it extend it further. Fork this game and make it awesome!
- Add some score keeping
- Improve the calculations for the angle of the ball bouncing off the paddles
- Turn it into Breakout!