Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Fix move_camera method #167

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/model/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ def keypress(direction, duration):
time.sleep(duration)
pag.keyUp(direction)

# if a single direction is 0 avoid pressing that key for any length of time so we don't nudge the camera over
if vertical == 0:
keypress(direction_h, sleep_h)
return
elif horizontal == 0:
keypress(direction_v, sleep_v)
return

thread_h = threading.Thread(target=keypress, args=(direction_h, sleep_h), daemon=True)
thread_v = threading.Thread(target=keypress, args=(direction_v, sleep_v), daemon=True)
delay = rd.fancy_normal_sample(0, max(sleep_h, sleep_v))
Expand Down