Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slice Fury

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.

Python OpenCV MediaPipe


Features

  • 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

Requirements

  • Python 3.10+
  • A webcam

Install dependencies:

pip install opencv-python mediapipe pygame numpy

On first launch, the hand landmark model (~8 MB) is downloaded automatically.


How to Run

python main.py

Press Q at any time to quit.


How to Play

  1. Hold your index finger up in front of the webcam
  2. On the main menu, hover your finger over a button for 1 second to select it
  3. Enter your name using the on-screen letter grid (same dwell-select)
  4. Swipe your finger through flying fruits to slice them
  5. Avoid bombs (black with a glowing fuse) — slicing one ends the game
  6. In Classic mode, missing 3 fruits costs all your lives
  7. In Arcade mode, combo slices add bonus time

Project Structure

├── 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

Controls

Action How
Navigate menus Hover index finger over button for 1 second
Slice fruit Swipe index finger through a fruit
Quit Press Q

License

MIT

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages