fix: remove randomization of rotation

This commit is contained in:
2021-06-04 11:31:39 -04:00
parent ca10062912
commit 8f519b5ab7
3 changed files with 12 additions and 15 deletions

24
main.py
View File

@@ -40,14 +40,9 @@ def main():
pygame.display.set_caption(win_title)
pygame.display.set_icon(loaded_icon)
pieces = []
current_piece = PieceGenerator.get_piece((300, 100))
pieces = [current_piece]
well = Well((280, 80))
x = 50
y = 50
for _ in range(6):
pieces.append(PieceGenerator.get_piece((x, y)))
x += 120
y += 100
is_running = True
while is_running:
@@ -58,16 +53,19 @@ def main():
is_running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
[piece.rotate() for piece in pieces]
current_piece.rotate()
if event.key == pygame.K_LEFT:
[piece.move((-tile_size, 0)) for piece in pieces]
current_piece.move((-tile_size, 0))
if event.key == pygame.K_RIGHT:
[piece.move((tile_size, 0)) for piece in pieces]
current_piece.move((tile_size, 0))
if event.key == pygame.K_UP:
[piece.move((0, -tile_size)) for piece in pieces]
current_piece.move((0, -tile_size))
if event.key == pygame.K_DOWN:
[piece.move((0, tile_size)) for piece in pieces]
current_piece.move((0, tile_size))
if event.key == pygame.K_z:
current_piece = PieceGenerator.get_piece((300, 100))
pieces.append(current_piece)
draw(screen, pieces + [well])
pygame.quit()