This project automates certain tasks within a game by detecting specific images on the screen and performing actions such as clicking and keyboard inputs. The script uses computer vision to locate elements and control the game through automation libraries.
- Image Detection: Detects various images on the screen using
pyautogui
. - Automated Clicking: Automatically clicks on detected areas.
- Keyboard Interaction: Listens for specific keyboard inputs to control the script.
- Logging: Provides detailed logging for monitoring the script's activity.
To get started with this project, you need to have Python installed. Then, you can install the required dependencies using pip and set up a virtual environment.
-
Create a Virtual Environment:
python -m venv venv
-
Activate the Virtual Environment:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install Dependencies:
pip install opencv-python numpy pyautogui keyboard
-
Deactivate the Virtual Environment (when done):
deactivate
- Configure Image Paths and Parameters: Update the image paths and other parameters in the script as needed.
- Set Up BlueStacks 5: Ensure BlueStacks 5 is running with a resolution of 900x1600 and 240 DPI.
- Run the Script: Execute the script using Python.
python combat2.py
- Control the script
-
Press space to pause/resume the script.
-
Press esc to exit the script.
.
├── images2
│ ├── fight.PNG
│ ├── random.PNG
│ ├── newgame.PNG
│ ├── starting.PNG
│ ├── share.PNG
│ ├── superkick.PNG
│ ├── sword.PNG
│ ├── shield.PNG
│ ├── end.PNG
│ ├── time1.PNG
│ ├── time2.PNG
├── combat2.py
├── README.md
└── venv
- Screen Capture: The script captures the screen to find specific elements.
- Color Detection: Detects a pink circle on the screen using HSV color space and contours.
- Image Matching: Matches predefined images on the screen to trigger clicks and other actions.
capture_screen(region=None)
: Captures a screenshot of the specified region.find_pink_circle(frame)
: Detects a pink circle in the provided frame.click_pink_circle()
: Clicks on the detected pink circle.find_and_click_image(image_path, confidence=0.8)
: Finds and clicks on the specified image if found on the screen.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or inquiries, please contact Through Email.
Follow me on social media:
- Instagram: @onurcan.gnc
- Twitter: @onurcangenc1999
Thank you for using this script ! Enjoy automating your game !