A computer vision Fruit Ninja-style game played entirely with your webcam — no mouse or keyboard needed. Hold up your index finger and slice flying fruits with your real hand.
- Real hand tracking via MediaPipe — your index finger is the blade
- Animated slash trail follows your fingertip in real time
- Fruit split animations with juice particle effects on every slice
- 3 game modes — Classic (3 lives), Arcade (90s timer + combo bonuses), Zen (no pressure)
- Combo system — chain slices within 600ms for up to 5x score multipliers
- Bombs — black fuse balls that end your game if sliced
- Difficulty scaling — fruits spawn faster as your score climbs
- 5 fruit types — watermelon, apple, orange, banana, pineapple
- Local leaderboard — top 10 scores per mode saved to disk
- Full hand-navigation UI — menus, settings, and name entry all controlled by finger dwell (hover 1 second to select)
- Settings screen — adjust game speed, lives count, and toggle bombs on/off
- Python 3.10+
- A webcam
Install dependencies:
pip install opencv-python mediapipe pygame numpyOn first launch, the hand landmark model (~8 MB) is downloaded automatically.
python main.pyPress Q at any time to quit.
- Hold your index finger up in front of the webcam
- On the main menu, hover your finger over a button for 1 second to select it
- Enter your name using the on-screen letter grid (same dwell-select)
- Swipe your finger through flying fruits to slice them
- Avoid bombs (black with a glowing fuse) — slicing one ends the game
- In Classic mode, missing 3 fruits costs all your lives
- In Arcade mode, combo slices add bonus time
├── main.py # Entry point and game loop
├── game.py # State machine: menu, playing, game over
├── fruit.py # Fruit, Bomb, particle and half-fruit physics
├── blade.py # MediaPipe hand tracking and slash trail
├── ui.py # All screen rendering (HUD, menus, overlays)
├── leaderboard.py # Load/save top scores to assets/scores.json
├── settings.py # Tunable game constants
└── assets/
├── scores.json # Auto-created local leaderboard
└── hand_landmarker.task # Auto-downloaded on first run
| Action | How |
|---|---|
| Navigate menus | Hover index finger over button for 1 second |
| Slice fruit | Swipe index finger through a fruit |
| Quit | Press Q |
MIT