A motion-controlled Pixel Ninja clone using computer vision for hand tracking. Slice fruits with your hand movements in this enhanced version featuring improved tracking, visual feedback, and fullscreen support.
- Real-time hand tracking using computer vision
- Dynamic blade trail effects
- Particle effects for sliced fruits
- Combo system with visual feedback
- Camera preview with tracking visualization
- Fullscreen support
- Smooth hand movement tracking
- Enhanced visual effects
- Python 3.8 or higher
- Webcam
- Required packages listed in requirements.txt
- Clone the repository:
git clone [repository-url]
cd fruit-ninja-enhanced- Install required packages:
pip install -r requirements.txt- Run the game:
python fruit_ninja_enhanced.py- Controls:
- Use your hand in front of the webcam to control the katana
- Move your hand to slice fruits
- Press F to toggle fullscreen mode
- Press ESC to exit fullscreen or quit game
- Camera Preview: Shows your hand position and tracking status
- Score Counter: Tracks your points
- Combo System: Chain multiple slices for bonus points
- Visual Guides: Help you understand the tracking area
fruit_ninja_enhanced.py: Main game filegame_engine.py: Core game mechanics and renderinggame_objects.py: Game object classes (fruits, blade trail)hand_tracking.py: Computer vision and hand tracking
The game requires the following asset directories:
background/: Background imagescursor/: Katana cursor imagefonts/: Font filesfruits/: Fruit imagessounds/: Sound effects
- pygame: Game engine and graphics
- opencv-python: Computer vision and webcam
- mediapipe: Hand tracking
- numpy: Numerical computations
- Ensure good lighting for better hand tracking
- Keep your hand within the tracking boundaries shown in the camera preview
- Make deliberate slicing motions for better detection
- Adjust your distance from the camera if tracking is inconsistent
- Hand tracking may be affected by poor lighting conditions
- Some systems may experience slight input lag
- Webcam initialization may take a few seconds
- Original Fruit Ninja concept by Halfbrick Studios
- Hand tracking implementation using Google's MediaPipe
- Game engine built with Pygame
This project is open source and available under the MIT License.
