update litris with board detection
This commit is contained in:
20
litris.py
20
litris.py
@@ -50,7 +50,7 @@ class Litris(GameBase):
|
|||||||
continue
|
continue
|
||||||
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
|
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
|
||||||
return
|
return
|
||||||
cv.waitKey(50)
|
cv.waitKey(25)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ class Litris(GameBase):
|
|||||||
|
|
||||||
self.field.cleared_rows = 1
|
self.field.cleared_rows = 1
|
||||||
|
|
||||||
cv.waitKey(200)
|
cv.waitKey(100)
|
||||||
self.stone_id_thread.set_pick_up_status(False)
|
self.stone_id_thread.set_pick_up_status(False)
|
||||||
|
|
||||||
def update_field_with_stored_edges(self):
|
def update_field_with_stored_edges(self):
|
||||||
@@ -126,7 +126,7 @@ class Litris(GameBase):
|
|||||||
self.keyboard.press(down)
|
self.keyboard.press(down)
|
||||||
self.keyboard.release(down)
|
self.keyboard.release(down)
|
||||||
print("drop down pressed:", down)
|
print("drop down pressed:", down)
|
||||||
cv.waitKey(50)
|
cv.waitKey(40)
|
||||||
|
|
||||||
def update_move_mode(self):
|
def update_move_mode(self):
|
||||||
if self.move_mode <=3:
|
if self.move_mode <=3:
|
||||||
@@ -159,13 +159,13 @@ class Litris(GameBase):
|
|||||||
self.keyboard.press(down)
|
self.keyboard.press(down)
|
||||||
self.keyboard.release(down)
|
self.keyboard.release(down)
|
||||||
print("direction pressed: ", down)
|
print("direction pressed: ", down)
|
||||||
cv.waitKey(120)
|
cv.waitKey(60)
|
||||||
|
|
||||||
if rotation == 3:
|
if rotation == 3:
|
||||||
self.keyboard.press('e')
|
self.keyboard.press('e')
|
||||||
self.keyboard.release('e')
|
self.keyboard.release('e')
|
||||||
print("rotation 1 pressed: e")
|
print("rotation 1 pressed: e")
|
||||||
cv.waitKey(40)
|
cv.waitKey(30)
|
||||||
elif rotation == 2:
|
elif rotation == 2:
|
||||||
self.keyboard.press('e')
|
self.keyboard.press('e')
|
||||||
self.keyboard.release('e')
|
self.keyboard.release('e')
|
||||||
@@ -179,28 +179,28 @@ class Litris(GameBase):
|
|||||||
self.keyboard.press('e')
|
self.keyboard.press('e')
|
||||||
self.keyboard.release('e')
|
self.keyboard.release('e')
|
||||||
print("rotation 3 pressed: e 1")
|
print("rotation 3 pressed: e 1")
|
||||||
cv.waitKey(20)
|
cv.waitKey(30)
|
||||||
self.keyboard.press('e')
|
self.keyboard.press('e')
|
||||||
self.keyboard.release('e')
|
self.keyboard.release('e')
|
||||||
print("rotation 3 pressed: e 2")
|
print("rotation 3 pressed: e 2")
|
||||||
cv.waitKey(20)
|
cv.waitKey(30)
|
||||||
self.keyboard.press('e')
|
self.keyboard.press('e')
|
||||||
self.keyboard.release('e')
|
self.keyboard.release('e')
|
||||||
print("rotation 3 pressed: e 3")
|
print("rotation 3 pressed: e 3")
|
||||||
cv.waitKey(20)
|
cv.waitKey(30)
|
||||||
|
|
||||||
if col_movement < 0:
|
if col_movement < 0:
|
||||||
for i in range(0, col_movement, - 1):
|
for i in range(0, col_movement, - 1):
|
||||||
self.keyboard.press(left)
|
self.keyboard.press(left)
|
||||||
self.keyboard.release(left)
|
self.keyboard.release(left)
|
||||||
print("move left 3 pressed:", left)
|
print("move left 3 pressed:", left)
|
||||||
cv.waitKey(40)
|
cv.waitKey(30)
|
||||||
else:
|
else:
|
||||||
for i in range(0, col_movement, 1):
|
for i in range(0, col_movement, 1):
|
||||||
self.keyboard.press(right)
|
self.keyboard.press(right)
|
||||||
self.keyboard.release(right)
|
self.keyboard.release(right)
|
||||||
print("move right 3 pressed:", right)
|
print("move right 3 pressed:", right)
|
||||||
cv.waitKey(40)
|
cv.waitKey(30)
|
||||||
|
|
||||||
def point_in_rect(self, point):
|
def point_in_rect(self, point):
|
||||||
for e in range(0, 20, 1):
|
for e in range(0, 20, 1):
|
||||||
|
|||||||
Reference in New Issue
Block a user