A hand-tracking version of the classic Fruit Ninja game using OpenCV and MediaPipe.
- Python 3.7+
- Webcam
- Required Python packages (install using
pip install -r requirements.txt
):- opencv-python
- mediapipe
- numpy
- pygame
- Install the required packages:
pip install -r requirements.txt
- Run the game:
python fruit_ninja.py
- Make sure you have good lighting for hand tracking to work properly
- Stand in front of your webcam
- Use your index finger to slice the fruits
- Try to slice as many fruits as possible
- If you miss a fruit, the game is over
- Press 'R' to restart after game over
- Press 'Q' to quit the game
- Real-time hand tracking using MediaPipe
- Multiple fruit types with different colors
- Slicing animation when fruits are cut
- Score tracking
- Game over screen with restart option
- Smooth fruit physics and movement