This is the T-Rex game im using for this example: http://www.trex-game.skipser.com/
pip install pillow
pip install pyautogui
pip install numpy
git clone https://github.com/0x414b/trex-bot.git
cd trex-bot
python -m venv trex_env
source trex_env/bin/activate
pip install pillow
pip install pyautogui
pip install numpy
First you'll need to place your browser with the game at the left side of the screen, and your IDE in the right.
Once you've done this, you have to specify the width of your screen resolution.
screen_width = 1920 # In my case it's 1920 // 2560 would be for MacBook Pro for example.
Run the code!
python trex.py
In case you want to tweak the bot, here's a simple graph of the coordinates. The origin point will be the T-Rex top-right corner.
dinosaur = [x, y] # For example [221, 374]
From here the hitbox distance will be measured in pixels as n.
hitbox_distance = n # Specifying the distance is optional. Default is 0.
The hitbox area is defined in n pixels - origin point coordinates.
hitbox_area = [x1, y1, x2, y2] # For example, if area is [60, 0, 100, 30], it would equal [281, 374, 321, 404]
I'm not a python expert, every advice is welcome!
With ❤ by 0x414b.