Tetris implementation with SRS and wall kicks . Try it.
This is a simple Tetris game built purely in Flutter, without using any third-party packages. The game consists of a grid where Tetromino pieces appear and fall. The player can move and rotate the pieces to fit them together. The goal is to create full horizontal lines, which will then clear and grant points.
- Tetromino pieces appear and fall
- Move and rotate pieces
- Clear full horizontal lines
- Score tracking
Make sure you have Flutter installed. You can check by running:
flutter --versionIf not installed, follow the official guide: Flutter Installation
- Clone this repository:
git clone https://github.com/your-username/flutter-tetris.git
- Navigate to the project directory:
cd flutter-tetris - Run the project:
flutter run
This game is built purely in Flutter, using only basic Dart packages.
The game board dimensions are defined by rowLength and colLength. The gameBoard is a 2D list representing the game grid.
currentPiece: The active Tetromino piece.score: The player's score.gameOver: Boolean to check if the game has ended.tetrominoColors: Colors of the Tetromino pieces (modifiable).
initState(): Called when the game starts.startGame(): Initializes the game loop.
Uses the dart:math package to implement a timer that updates the game at regular intervals.
Methods to control the pieces:
moveLeft(): Moves the piece left.moveRight(): Moves the piece right.rotatePiece(): Rotates the piece.
The build() method constructs the game UI:
- Grid display
- Score counter
- Control buttons
This project is licensed under the MIT License - see the LICENSE file for details.
Hope you enjoy the code and the game! Leave a ⭐ if you like it! 🚀






