block-break-cli
v1.0.0
Published
A CLI breakout game for the terminal
Maintainers
Readme
block-break-cli
A classic breakout game that runs in your terminal
┌──────────────────────────────────────────────────────────────┐
│ ###### ###### ###### ###### ###### ###### ###### │
│ ###### ###### ###### ###### ###### ###### ###### │
│ ###### ###### ###### ###### ###### ###### ###### │
│ │
│ ● │
│ │
│ │
│ ========== │
├──────────────────────────────────────────────────────────────┤
│ Score: 120 | Lives: ♥♥♥ | Level: 1 | Hi: 450 │
└──────────────────────────────────────────────────────────────┘Features
- Classic Gameplay - The nostalgic breakout experience, right in your terminal
- 10+ Levels - Progressive difficulty with increasing block rows (customizable)
- Colorful Blocks - 6 vibrant colors: red, yellow, green, cyan, blue, magenta
- Score System - Earn more points for blocks at the top
- Lives System - Start with 3 lives (customizable), don't let the ball fall!
- High Score - Your best scores are saved locally
- Responsive Controls - Smooth paddle movement with arrow keys
- Customizable - Adjust lives, levels, speed, paddle size, and game area via CLI options
- Fixed Game Area - Consistent 60x24 game area centered in terminal (customizable)
Installation
npm install -g block-break-cliUsage
block-breakCommand Line Options
Customize game settings with command line options:
block-break [options]| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| --lives <n> | -l | Initial number of lives | 3 |
| --max-level <n> | -m | Maximum level to reach | 10 |
| --speed <ms> | -s | Game speed (lower = faster) | 80 |
| --paddle-width <n> | -w | Width of the paddle | 10 |
| --paddle-speed <n> | -p | Paddle movement speed | 3 |
| --width <n> | | Game area width (min: 40) | 60 |
| --height <n> | | Game area height (min: 20) | 24 |
| --help | -h | Show help message | - |
| --version | -v | Show version | - |
Examples
# Easy mode: more lives
block-break --lives 5
# Hard mode: faster speed, fewer lives
block-break -s 50 -l 1
# Extended game: 20 levels
block-break --max-level 20
# Wide paddle for beginners
block-break --paddle-width 15
# Combine options
block-break -l 5 -m 20 -w 12
# Larger game area
block-break --width 80 --height 30Controls
| Key | Action |
|-----|--------|
| ← → | Move paddle |
| a d | Move paddle (alternative) |
| Space | Launch ball / Pause game |
| q | Quit game |
Menu Options
- Start Game - Begin a new game
- High Scores - View the top 10 scores
- Quit - Exit the application
Gameplay
- Launch the game with
block-break - Select "Start Game" from the menu
- Press
Spaceto launch the ball - Move the paddle to bounce the ball and destroy blocks
- Clear all blocks to advance to the next level
- Don't let the ball fall below the paddle!
Tech Stack
- TypeScript - Type-safe development
- Blessed - Terminal UI rendering
- Conf - Persistent high score storage
Development
# Clone the repository
git clone https://github.com/Sato-Daichi/block-break-cli.git
cd block-break-cli
# Install dependencies
npm install
# Build
npm run build
# Link for local testing
npm link
# Run the game
block-breakProject Structure
block-break-cli/
├── src/
│ ├── index.ts # Application entry point
│ ├── game/
│ │ ├── Game.ts # Main game loop & logic
│ │ ├── Paddle.ts # Paddle control
│ │ ├── Ball.ts # Ball physics
│ │ ├── Block.ts # Block management
│ │ └── Level.ts # Level progression
│ ├── ui/
│ │ ├── Screen.ts # Game rendering
│ │ ├── Menu.ts # Main menu
│ │ └── ScoreBoard.ts # High score display
│ └── utils/
│ ├── Config.ts # Game configuration
│ └── HighScore.ts # Score persistence
├── bin/
│ └── cli.js # CLI entry point
└── dist/ # Compiled JavaScriptRequirements
- Node.js >= 14.0.0
- A terminal that supports colors and Unicode
License
MIT
Made with ♥ in the terminal
