Play the classic Snake game using just your hand gestures! This game uses OpenCV and MediaPipe to track hand movements via a webcam, allowing you to guide the snake and collect points.
- Hand-Controlled Snake: Move your hand to navigate the snake.
- Smooth Movement & Trails for a better gaming experience.
- Real-time Score & Timer displayed on the sidebar.
- Dynamic Ball Mechanics:
- 3 Balls Always on Screen: New balls appear when one is collected or expires.
- Point System:
- ๐ข Green Ball โ 1 Point
- ๐ Orange Ball โ 2 Points
- ๐ด Red Ball โ 3 Points
- Ball Collection System:
- If the snake touches a ball, it disappears and adds points to the score.
- If the ball is not collected in 5 seconds, it disappears and a new one appears.
- Game Over Screen with the final score displayed and an automatic restart after timeout.
- Sound effects when collecting balls.
- OpenCV Game Window Embedded in Streamlit.
1๏ธโฃ Run the game:
streamlit run game.py
2๏ธโฃ Start the game by clicking "Start Game" in the sidebar.
3๏ธโฃ Control the Snake with Your Hand: Move your hand in front of the camera to navigate the snake.
4๏ธโฃ Collect the balls (๐ข๐ ๐ด) to gain points.
5๏ธโฃ The game lasts 60 seconds, after which a Game Over screen appears with your final score.
- Python
- OpenCV (for real-time video processing)
- MediaPipe (for hand tracking)
- Streamlit (for embedding the OpenCV window in a web-based UI)
1๏ธโฃ Clone the repository:
git clone https://github.com/MehnazAli2004/Hand-Controlled-Snake-Game-using-OpenCV.git
cd Hand-Controlled-Snake-Game-using-OpenCV
2๏ธโฃ Install dependencies:
pip install -r requirements.txt
3๏ธโฃ Run the game:
streamlit run game.py
4๏ธโฃ Grant camera access when prompted and start playing!
- ๐ก Collision Detection (self-collision & walls)
- ๐ก Leaderboard & High Scores
- ๐ก Power-ups & Special Abilities
- ๐ก Multiplayer Mode
- ๐ก Improved Graphics & UI Enhancements
This project is open-source. Feel free to use, modify, and contribute!