- Fork the repo
- clone it on your system
- make the required changes in the python file (main.py)
- push your changes on github
- make a pull request
Navigate to the folder and run the following command to install the required python libraries
pip install -r requirements.txt
Problem Statement: Virtual Air Hockey Game
You are tasked with developing a virtual air hockey game using computer vision and hand tracking. The game should be played using a webcam, where the player controls the paddle with their hand to hit a virtual puck and score points by hitting targets that appear on the screen. The game has a time limit, and the player's objective is to score as many points as possible within the given time.
Features and Requirements:
-
Hand Tracking:
- Utilize the
mediapipe
library for hand tracking. - The position of the player's hand, specifically the index finger tip, should control the paddle's position on the screen.
- Utilize the
-
Game Elements:
- Display a virtual air hockey table on the screen.
- Implement a puck that moves around the screen with an initial velocity.
- Create a paddle controlled by the player's hand.
- Generate multiple target positions randomly on the screen.The target image has been provided.
-
Game Logic:
- The puck should bounce off the walls of the screen.
- If the puck collides with the paddle, its vertical velocity should reverse.
- If the puck enters the region of a target, the player scores a point, and the target disappears.
- After hitting a target, increase the puck's velocity to make the game more challenging.
-
Score and Timer:
- Display the player's score on the screen.
- Implement a timer indicating the remaining time to play.
-
Game Over Conditions:
- The game should end when either all targets are hit or the time limit is reached.
- Display a game over message with the player's final score.
-
User Interface:
- Provide clear and visible text displaying the player's score and the remaining time.
-
User Interaction:
- Allow the player to quit the game by pressing the 'q' key.
-
Visual Effects:
- Add visual effects to represent the puck, paddle, and targets on the screen.
-
Congratulations Message:
- If the player hits all the targets within the time limit, display a congratulations message.
-
Optimizations:
- Optimize the code for efficiency and smooth gameplay.
- Implement any additional features or improvements to enhance the gaming experience.
Note: Ensure that the code is well-documented, making it easy for others to understand.Also feel free to add more features to the game to make it more interesting.
All the Best!!