You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tetris/README.md

69 lines
2.0 KiB

# Tetris Game
A classic Tetris game implemented in Go using the Ebitengine game engine.
## Features
- Classic Tetris gameplay
- Ghost piece preview
- Next piece preview
- Line clearing with scoring
- Progressive difficulty levels
- Smooth controls with wall kicks
## Project Structure
```
tetris/
├── main.go # Application entry point
├── go.mod # Go module definition
├── go.sum # Go module checksums
├── assets/ # Game assets (future use)
├── internal/ # Internal packages
│ ├── game/ # Core game logic
│ │ └── game.go # Game state and rendering
│ ├── tetromino/ # Tetromino (falling pieces) logic
│ │ └── tetromino.go # Piece shapes, rotation, movement
│ └── types/ # Shared type definitions
│ └── types.go # Block types and colors
└── pkg/ # Public packages
└── config/ # Configuration constants
└── config.go # Game configuration and constants
```
## Architecture
The project follows Go best practices with a clean package structure:
- **`main.go`**: Entry point that initializes the game
- **`pkg/config`**: Contains all game configuration constants
- **`internal/types`**: Defines core data types and enums
- **`internal/tetromino`**: Handles tetromino piece logic (shapes, rotation, movement)
- **`internal/game`**: Core game mechanics (board state, input handling, rendering)
## Controls
- **Left/Right Arrow**: Move piece horizontally
- **Up Arrow**: Rotate piece clockwise
- **Down Arrow**: Soft drop (faster falling)
- **Space**: Hard drop (instant drop)
- **Space** (when game over): Restart game
## Building and Running
```bash
# Run the game
go run .
# Build executable
go build -o tetris
./tetris
```
## Dependencies
- [Ebitengine](https://ebitengine.org/) v2.8.8 - 2D game engine for Go
## License
This project is open source and available under the MIT License.