# 俄罗斯方块Java **Repository Path**: changxin666/tetris-java ## Basic Information - **Project Name**: 俄罗斯方块Java - **Description**: 基于swing的图形界面写的俄罗斯方块 - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-17 - **Last Updated**: 2025-07-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: 俄罗斯方块, 小游戏, Java ## README # Tetris-Java This is a classic Tetris game implemented using Java. The project utilizes Java Swing to build the graphical user interface and implements core game mechanics, including block falling, movement, rotation, and a scoring system. ## 🧩 Features - **Block Falling**: Blocks automatically fall over time. - **Movement Control**: Use the keyboard to move blocks left, right, and accelerate their descent. - **Rotation Functionality**: Supports block rotation. - **Scoring System**: The score increases whenever a complete row is filled. - **Game Over Detection**: The game ends when a new block cannot be placed. ## 📦 Main Components - `Tetris.java`: Main game logic and interface initialization. - `Tool.java`: Contains core operations such as block drawing, clearing, moving, and rotating. - `Data.java`: Stores data for all block shapes. - `Score.java`: Manages the game score. - `Test.java`: Utility class for testing. ## 🕹️ Controls - `A`: Move left - `D`: Move right - `S`: Accelerate descent - `W`: Rotate block ## 🚀 How to Run 1. Ensure you have installed JDK and configured your Java environment. 2. Clone the repository locally: ```bash git clone https://gitee.com/changxin666/tetris-java.git ``` 3. Compile and run the project: ```bash cd tetris-java javac -d . Tetris/Tetris.java java Tetris.Tetris ``` ## 📜 License This project uses the MIT License. For more details, please refer to the [LICENSE](LICENSE) file. ## 👨‍💻 Author QiuShui Contributions and improvement suggestions are welcome! If you have any questions or ideas, please raise them on the project's Issues page.