litris fixes
This commit is contained in:
42
litris.py
42
litris.py
@@ -96,18 +96,38 @@ class Litris(GameBase):
|
||||
print("offset column:", offset_col)
|
||||
self.field.drop(current_tetromino, column)
|
||||
self.move_stone(column - offset_col, rotation)
|
||||
for i in range(1, 10, 1):
|
||||
self.keyboard.press(Key.down)
|
||||
self.keyboard.release(Key.down)
|
||||
print("direction pressed: drop down")
|
||||
cv.waitKey(50)
|
||||
self.drop_down()
|
||||
self.stone_id_thread.set_pick_up_status(False)
|
||||
print(self.field)
|
||||
if self.field.get_line_count() % 5 == 0:
|
||||
self.field.rotate_state()
|
||||
self.update_move_mode()
|
||||
#if self.field.get_line_count() % 6 == 0:
|
||||
# self.field.rotate_state()
|
||||
# self.update_move_mode()
|
||||
# self.field.cleared_rows = 1
|
||||
|
||||
|
||||
def drop_down(self):
|
||||
if self.move_mode == 1:
|
||||
down = Key.down
|
||||
left = Key.left
|
||||
right = Key.right
|
||||
elif self.move_mode == 2:
|
||||
down = Key.left
|
||||
left = Key.up
|
||||
right = Key.down
|
||||
elif self.move_mode == 3:
|
||||
down = Key.up
|
||||
left = Key.right
|
||||
right = Key.left
|
||||
elif self.move_mode == 4:
|
||||
down = Key.right
|
||||
left = Key.down
|
||||
right = Key.up
|
||||
for i in range(1, 10, 1):
|
||||
self.keyboard.press(down)
|
||||
self.keyboard.release(down)
|
||||
print("drop down pressed:", down)
|
||||
cv.waitKey(50)
|
||||
|
||||
def update_move_mode(self):
|
||||
if self.move_mode <=3:
|
||||
self.move_mode = self.move_mode + 1
|
||||
@@ -277,7 +297,7 @@ class Litris(GameBase):
|
||||
# Press and release space
|
||||
self.keyboard.press(down)
|
||||
self.keyboard.release(down)
|
||||
print("direction pressed: down")
|
||||
print("direction pressed: ", down)
|
||||
cv.waitKey(120)
|
||||
|
||||
if rotation == 3:
|
||||
@@ -312,13 +332,13 @@ class Litris(GameBase):
|
||||
for i in range(0, col_movement, - 1):
|
||||
self.keyboard.press(left)
|
||||
self.keyboard.release(left)
|
||||
print("move left 3 pressed")
|
||||
print("move left 3 pressed:", left)
|
||||
cv.waitKey(40)
|
||||
else:
|
||||
for i in range(0, col_movement, 1):
|
||||
self.keyboard.press(right)
|
||||
self.keyboard.release(right)
|
||||
print("move right 3 pressed")
|
||||
print("move right 3 pressed:", right)
|
||||
cv.waitKey(40)
|
||||
|
||||
def point_in_rect(self, point):
|
||||
|
||||
Reference in New Issue
Block a user