From 23bb3e1153dc103a2eaf1623d579c86ee5cfa255 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 1 Mar 2025 20:09:08 -0800 Subject: [PATCH] Fix rotation --- tetros/src/tetrisboard/falling.rs | 66 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tetros/src/tetrisboard/falling.rs b/tetros/src/tetrisboard/falling.rs index 1e9b96a..58e5ffb 100644 --- a/tetros/src/tetrisboard/falling.rs +++ b/tetros/src/tetrisboard/falling.rs @@ -141,31 +141,31 @@ impl FallingTetromino { // Straight // (Tetromino::Straight, Direction::North) => [ - (self.center_x - 2, self.center_y - 1), - (self.center_x - 1, self.center_y - 1), (self.center_x, self.center_y - 1), - (self.center_x + 1, self.center_y - 1), + (self.center_x, self.center_y), + (self.center_x, self.center_y + 1), + (self.center_x, self.center_y + 2), ], (Tetromino::Straight, Direction::East) => [ - (self.center_x + 1, self.center_y - 2), - (self.center_x + 1, self.center_y - 1), + (self.center_x - 1, self.center_y), + (self.center_x, self.center_y), (self.center_x + 1, self.center_y), - (self.center_x + 1, self.center_y + 1), + (self.center_x + 2, self.center_y), ], (Tetromino::Straight, Direction::South) => [ - (self.center_x - 2, self.center_y + 1), - (self.center_x - 1, self.center_y + 1), - (self.center_x, self.center_y + 1), + (self.center_x + 1, self.center_y - 1), + (self.center_x + 1, self.center_y), (self.center_x + 1, self.center_y + 1), + (self.center_x + 1, self.center_y + 2), ], (Tetromino::Straight, Direction::West) => [ - (self.center_x - 1, self.center_y - 2), - (self.center_x - 1, self.center_y - 1), - (self.center_x - 1, self.center_y), (self.center_x - 1, self.center_y + 1), + (self.center_x, self.center_y + 1), + (self.center_x + 1, self.center_y + 1), + (self.center_x + 2, self.center_y + 1), ], // @@ -234,31 +234,31 @@ impl FallingTetromino { // Left Skew // (Tetromino::SkewLeft, Direction::North) => [ - (self.center_x - 1, self.center_y), - (self.center_x, self.center_y), + (self.center_x - 1, self.center_y + 1), (self.center_x, self.center_y + 1), - (self.center_x + 1, self.center_y + 1), + (self.center_x, self.center_y), + (self.center_x + 1, self.center_y), ], (Tetromino::SkewLeft, Direction::East) => [ - (self.center_x, self.center_y - 1), - (self.center_x, self.center_y), + (self.center_x - 1, self.center_y - 1), (self.center_x - 1, self.center_y), - (self.center_x - 1, self.center_y + 1), + (self.center_x, self.center_y), + (self.center_x, self.center_y + 1), ], (Tetromino::SkewLeft, Direction::South) => [ - (self.center_x - 1, self.center_y - 1), - (self.center_x, self.center_y - 1), + (self.center_x - 1, self.center_y), (self.center_x, self.center_y), - (self.center_x + 1, self.center_y), + (self.center_x, self.center_y - 1), + (self.center_x + 1, self.center_y - 1), ], (Tetromino::SkewLeft, Direction::West) => [ - (self.center_x + 1, self.center_y - 1), - (self.center_x + 1, self.center_y), + (self.center_x, self.center_y - 1), (self.center_x, self.center_y), - (self.center_x, self.center_y + 1), + (self.center_x + 1, self.center_y), + (self.center_x + 1, self.center_y + 1), ], // @@ -267,27 +267,27 @@ impl FallingTetromino { (Tetromino::SkewRight, Direction::North) => [ (self.center_x - 1, self.center_y), (self.center_x, self.center_y), - (self.center_x, self.center_y - 1), - (self.center_x + 1, self.center_y - 1), + (self.center_x, self.center_y + 1), + (self.center_x + 1, self.center_y + 1), ], (Tetromino::SkewRight, Direction::East) => [ - (self.center_x, self.center_y + 1), + (self.center_x, self.center_y - 1), (self.center_x, self.center_y), - (self.center_x + 1, self.center_y), - (self.center_x + 1, self.center_y - 1), + (self.center_x - 1, self.center_y), + (self.center_x - 1, self.center_y + 1), ], (Tetromino::SkewRight, Direction::South) => [ - (self.center_x - 1, self.center_y + 1), - (self.center_x, self.center_y + 1), + (self.center_x - 1, self.center_y - 1), + (self.center_x, self.center_y - 1), (self.center_x, self.center_y), (self.center_x + 1, self.center_y), ], (Tetromino::SkewRight, Direction::West) => [ - (self.center_x - 1, self.center_y - 1), - (self.center_x - 1, self.center_y), + (self.center_x + 1, self.center_y - 1), + (self.center_x + 1, self.center_y), (self.center_x, self.center_y), (self.center_x, self.center_y + 1), ],