improve lock
This commit is contained in:
parent
54f2554b2a
commit
f2bbafeb8b
@ -255,7 +255,10 @@ AGAIN""".format(
|
||||
def move(self, movement, prelock=True):
|
||||
moved = super().move(movement, prelock)
|
||||
if self.current.prelocked:
|
||||
self.current.sprites.set_alpha(PRELOCKED_ALPHA)
|
||||
alpha = PRELOCKED_ALPHA
|
||||
else:
|
||||
alpha = NORMAL_ALPHA
|
||||
self.current.sprites.set_alpha(alpha)
|
||||
if moved:
|
||||
size = MINO_SIZE * self.scale
|
||||
change_x = movement.x * size
|
||||
|
@ -223,21 +223,16 @@ class TetrisLogic():
|
||||
)
|
||||
|
||||
def lock(self):
|
||||
self.current.prelocked = False
|
||||
self.stop(self.lock)
|
||||
|
||||
# Piece unlocked
|
||||
if self.can_move(
|
||||
self.current.coord + Movement.DOWN,
|
||||
(mino.coord for mino in self.current)
|
||||
):
|
||||
self.restart(self.lock, self.lock_delay)
|
||||
return
|
||||
|
||||
# Start lock
|
||||
self.current.prelocked = False
|
||||
self.stop(self.lock)
|
||||
if self.pressed_actions:
|
||||
self.auto_repeat = False
|
||||
self.restart(self.repeat_action, self.AUTOREPEAT_DELAY)
|
||||
|
||||
# Game over
|
||||
if all(
|
||||
(mino.coord + self.current.coord).y >= self.NB_LINES
|
||||
@ -246,6 +241,10 @@ class TetrisLogic():
|
||||
self.game_over()
|
||||
return
|
||||
|
||||
if self.pressed_actions:
|
||||
self.auto_repeat = False
|
||||
self.restart(self.repeat_action, self.AUTOREPEAT_DELAY)
|
||||
|
||||
# T-Spin
|
||||
if (
|
||||
type(self.current) == T
|
||||
|
Loading…
x
Reference in New Issue
Block a user