This is a Sigle Player Game.
Playstore Link: Stick Hero
Easy
Stretch the stick in order to reach and walk on the platforms. Watch out! If the stick is not long enough, you will fall down!
- Computer with OpenCV-Python, Numpy, ADB Tool and required drivers set up.
- An Android Device with the Stick Hero game installed on it. (Turn on the Developer options for better visualization)
- USB data transfer cable.
The following command instantaneously takes the screenshot of the connected device and stores it in the SD card following the specified path.
system(' adb shell screencap -p /sdcard/stick.png ');
The following command pulls it from the SD card of the android device into the working system following the path specified
system(' adb pull /sdcard/stick.png ');
The pulled image is stored in the form of a matrix of pixel values by the Opencv.
img = cv2.imread('stick.png');
Once the screenshot is obtained, Position of Player and Target Pole centre is calculated using image processing.
Distance between player and target pole center is calculated and touch is simulated according to linear equation.
dist = posPlayer - posTarget
touch_time = 1.430*dist;
The following command presses at the point on the screen with the co-ordinates mentioned as (x, y). This is used to simulate for touch_time
system('adb shell input swipe 360 640 360 640 '+str(touch_time))
After connecting your phone to laptop with satisfied envrionment. check phone is connected or not, with command
adb devices
if device is connected and not authorized it will show in output otherwise it will show device-id and device.
python stick_solver.py
The Game was tested on 1280x720 android device ( Moto G3 ). So for other device calculate area (in my case 100,800 to 700,820 pixel on device (x,y) format) for processing the image and finding distance between player and target block centre.