This Tetris game is developed using Java's Swing and AWT libraries, offering a classic gaming experience with modern coding practices. The game features the traditional Tetris gameplay, including 7 different tetrominoes, with additional features such as pause, score tracking, line clearing, level progression, collision detection, and background music to enhance the playing experience.
- 7 Tetrominoes (Minos): Includes all classic Tetris blocks.
- Game Controls: Easy-to-use keyboard controls for moving, rotating, and dropping tetrominoes.
- Line Clearing: Complete lines to clear them from the board and earn points.
- Levels: The game speed increases as you progress, offering a challenging experience.
- Score System: Earn points by clearing lines and advancing through levels.
- Pause/Resume: Players can pause the game at any moment and resume where they left off.
- Collision Detection: Ensures a realistic gameplay experience.
- Music and Sound Effects: Enhances gameplay with engaging audio.
Ensure you have Java Development Kit (JDK) installed on your machine to run and compile the game. The game is developed and tested with JDK version 21.
-
Clone the repository to your local machine using Git:
git clone https://github.com/hasnatrasool163/Tetris-in-Java.git
-
Navigate to the cloned directory:
cd java-tetris-game
-
Compile the Java files. For example, if your main class is in
tetris.Game
, you would run:javac tetris/Game.java javac Main.java
-
Run the game:
java tetris.Game java Main
- Move Left: Arrow key left /A
- Move Right: Arrow key right / D
- Rotate: Up arrow key / W
- Drop: Down arrow key / S
- Pause/Resume Game: Press 'SpaceBar'
The objective is to place the tetrominoes to create complete lines, which will then be cleared from the board. The game ends when the Tetris playfield is filled.
- Muhammad Hasnat Rasool - Initial work - YourGitHub
- Hat tip to anyone whose code was used
- Inspiration
- etc