Skip to content

Commit ddc8c9e

Browse files
committed
moved get_cord method to mouseenvet
1 parent b936749 commit ddc8c9e

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Diff for: game.py

-10
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
# get_cords for gettings game button x and y positions
44

55
import time
6-
import win32api
76
import gameCoordinates
87
import mouseEvents
98

10-
x_pad = 361
11-
y_pad = 344
12-
139
"""
1410
Recipes:
1511
onigiri: 2 rice, 1 nori
@@ -87,12 +83,6 @@ def clearTables():
8783
mouseEvents.leftClick()
8884
time.sleep(2)
8985

90-
def getCords():
91-
x, y = win32api.GetCursorPos()
92-
x = x - x_pad
93-
y = y - y_pad
94-
print(x, y)
95-
9686
def startGame():
9787
# first play button
9888
mouseEvents.mousePos((883, 524))

Diff for: mouseEvents.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import time
44
import win32api, win32con
55

6+
x_pad = 361
7+
y_pad = 344
8+
69
def leftClick():
710
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
811
time.sleep(0.1)
@@ -20,4 +23,10 @@ def leftUp():
2023
print("left release")
2124

2225
def mousePos(cord):
23-
win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]))
26+
win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]))
27+
28+
def getCords():
29+
x, y = win32api.GetCursorPos()
30+
x = x - x_pad
31+
y = y - y_pad
32+
print(x, y)

0 commit comments

Comments
 (0)