v0.2.3
This commit is contained in:
parent
bacd95ca07
commit
a194faa33d
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "terminis"
|
name = "terminis"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
description = "Tetris clone for terminal. Ideal for servers without GUI!"
|
description = "Tetris clone for terminal. Ideal for servers without GUI!"
|
||||||
authors = ["adrienmalin <41926238+adrienmalin@users.noreply.github.com>"]
|
authors = ["adrienmalin <41926238+adrienmalin@users.noreply.github.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -118,16 +118,16 @@ class Tetromino:
|
|||||||
self.rotated_last = False
|
self.rotated_last = False
|
||||||
self.hold_enabled = True
|
self.hold_enabled = True
|
||||||
|
|
||||||
def can_move(self, movement, rotated_minoes_positions=None):
|
def can_move(self, movement, minoes_positions):
|
||||||
potential_position = self.position + movement
|
potential_position = self.position + movement
|
||||||
if all(
|
if all(
|
||||||
self.matrix.is_free_cell(potential_position+mino_position)
|
self.matrix.is_free_cell(potential_position+mino_position)
|
||||||
for mino_position in rotated_minoes_positions or self.minoes_positions
|
for mino_position in minoes_positions
|
||||||
):
|
):
|
||||||
return potential_position
|
return potential_position
|
||||||
|
|
||||||
def move_rotate(self, movement, rotated_minoes_positions=None):
|
def move_rotate(self, movement, minoes_positions):
|
||||||
potential_position = self.can_move(movement, rotated_minoes_positions)
|
potential_position = self.can_move(movement, minoes_positions)
|
||||||
if potential_position:
|
if potential_position:
|
||||||
self.position = potential_position
|
self.position = potential_position
|
||||||
if "lock" in scheduler:
|
if "lock" in scheduler:
|
||||||
@ -138,7 +138,7 @@ class Tetromino:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def move(self, movement, lock=True):
|
def move(self, movement, lock=True):
|
||||||
if self.move_rotate(movement):
|
if self.move_rotate(movement, self.minoes_positions):
|
||||||
self.rotated_last = False
|
self.rotated_last = False
|
||||||
self.matrix.refresh()
|
self.matrix.refresh()
|
||||||
return True
|
return True
|
||||||
@ -318,7 +318,7 @@ class Matrix(Window):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def lock(self):
|
def lock(self):
|
||||||
if not self.piece.can_move(Movement.DOWN):
|
if not self.piece.can_move(Movement.DOWN, self.piece.minoes_positions):
|
||||||
scheduler.cancel("fall")
|
scheduler.cancel("fall")
|
||||||
|
|
||||||
t_spin = self.piece.t_spin()
|
t_spin = self.piece.t_spin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user