I trained a cascade classifier for Audiosurf 2 to detect the blocks. Then I calculated the center coordinates of the block so I can move the mouse to that position while I'm playing.
But the cursor disappears when the game starts and I play as the ship moving left and right. My script does not move the mouse in the game. The game only registers the movements from my physical mouse. But when I pause the game, the mouse reappears and it centers on the block like it should. Click function on the block also does not work.
I tried several libraries: mouse
, pyautogui
, pydirectinput
, and pynput
. It's possible for me to get the current position of the mouse but cannot move it. None of them worked without having a cursor on screen. The keyboard presses from these libraries work fine however.
Several posts mentioned that games use directinput so I tried both win32api
from this answer and ctypes
from another answer. They also didn't work in game.
I feel like I exhausted all my options at this point. Any help would be appreciated.
question from:
https://stackoverflow.com/questions/65836072/game-is-blocking-python-mouse-movements 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…