Example #1
0
def hit_ball(ball, white_ball):
    bx, by = ball
    wx, wy = white_ball

    move_x = 100 if bx < wx else -100
    move_y = 100 if by < wy else -100
    target_stick_at(bx+move_x/10, by+move_y/10)

    print("move stick to, ", wx + move_x, wy + move_y)
    mouse_controls.set_mouse_position(bx + move_x, by + move_y)
    wait()
    mouse_controls.left_mouse_up()
Example #2
0
def target_stick_at(x, y):
    for i in range(11):
        mouse_controls.set_mouse_position(x + (i % 2), y)
        wait()
    mouse_controls.left_mouse_down()
    wait()
Example #3
0
def target_stick_at(x, y):
    mouse_controls.set_mouse_position(x, y)
    mouse_controls.left_mouse_down()
    wait(.1)
Example #4
0
def shot_from_right():
    target_stick_at(TABLE_X_CENTER, TABLE_Y_CENTER)
    mouse_controls.set_mouse_position(TABLE_X_CENTER + 200, TABLE_Y_CENTER)
    mouse_controls.left_mouse_up()