Improve handling and fix some bugs
This commit is contained in:
@@ -570,6 +570,8 @@ class Game:
|
||||
if not self.intersects_board(*np, new_piece):
|
||||
self.current_block = new_piece
|
||||
self.current_block_pos = np
|
||||
# give the user some leeway to splin many times
|
||||
self.subcell_drop = 0
|
||||
return
|
||||
|
||||
def move_current_piece(self, dir: Direction):
|
||||
@@ -577,6 +579,8 @@ class Game:
|
||||
self.subcell_move += dx
|
||||
move_cell = int(self.subcell_move)
|
||||
self.subcell_move -= move_cell
|
||||
# give the user some leeway to move in tight quarters
|
||||
self.subcell_drop = 0
|
||||
if move_cell:
|
||||
new_pos = Cell(
|
||||
self.current_block_pos.x + move_cell, self.current_block_pos.y
|
||||
@@ -837,6 +841,7 @@ class Game:
|
||||
self.process_and_draw_help_overlay()
|
||||
|
||||
def start_new_game(self):
|
||||
self.cur_random_peice_seq = None
|
||||
self.clear_board()
|
||||
self.next_piece = None
|
||||
self.swap_in_next_piece(True)
|
||||
@@ -941,7 +946,6 @@ class Game:
|
||||
self.clock.tick(Game.FRAMERATE)
|
||||
|
||||
def swap_in_next_piece(self, force: bool = False):
|
||||
self.cur_random_peice_seq = None
|
||||
if not self.next_piece or force:
|
||||
self.next_piece = self.random_tetromino()
|
||||
self.current_block = self.random_tetromino()
|
||||
|
||||
Reference in New Issue
Block a user