In this we are gonna use the http://www.trex-game.skipser.com/ automate the Dino..which is same as that of Google Dino
- Pyautogui
- Numpy
- ImageGrab,ImageOps
- Time
First we are going to click on the screen to start the Dino. Here we are having 2 conditions
- Initial Start of the Dino (That's starting the Game for the very first time)
- Restart Mode
So the basic idea is to click at the center of the screen where the restart button is located.Using mspaint we can plot the x and y as shown below
The idea is to locate the tree at some distance away from the dino. Considering the box to identify the tree and bird.
In this case the box (x1,y2,x2,y2) as (485,391,500,427)
As the background different from the tree, it is easy to find the color of the tree using ImageGrab and process it using nump. And it leads to the condition when the color is different key up is triggered.
Using this technic we can automate games such as Tap Soccers