44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
import cv2 as cv
|
|
import pydirectinput
|
|
from game_base_class import GameBase
|
|
from flappy_pos_discovery_thread import FlappyPosDiscovery
|
|
|
|
class Flappy(GameBase):
|
|
|
|
def __init__(self, overlay):
|
|
super().__init__(overlay)
|
|
|
|
self.litris_reset_board = cv.imread("control_elements/sodoku_reset_button.jpg", cv.IMREAD_COLOR)
|
|
|
|
self.flappy_pos_disc = FlappyPosDiscovery()
|
|
|
|
def assess_playfield_and_make_move(self):
|
|
#last_letter_received = time()
|
|
wait_timer = 380
|
|
while True:
|
|
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
|
|
return
|
|
tmp = 20
|
|
self.click()
|
|
cv.waitKey(int(100))
|
|
if tmp % 5 == 0:
|
|
self.click()
|
|
cv.waitKey(int(wait_timer -100))
|
|
|
|
'''
|
|
if self.flappy_pos_disc.next_gate_height[0] is not 0:
|
|
offset = (self.flappy_pos_disc.next_gate_height[0] + 120) - self.flappy_pos_disc.current_pet_height
|
|
if offset > 50:
|
|
offset = 50
|
|
elif offset < -50:
|
|
offset = -50
|
|
print(offset)
|
|
wait_timer = 380 + offset
|
|
print(wait_timer)
|
|
print("pet_pos: ", self.flappy_pos_disc.current_pet_height)
|
|
print("next gate: ", self.flappy_pos_disc.next_gate_height[0] + 120) '''
|
|
|
|
def click(self):
|
|
pydirectinput.mouseDown()
|
|
cv.waitKey(50)
|
|
pydirectinput.mouseUp() |