🎮 Description
This open-source project is inspired by the classic Breakout, built with Astro and game logic in TypeScript using canvas.
The goal is to destroy all bricks by bouncing the ball with the paddle while preventing the ball from falling outside the play area. Each game starts with a difficulty menu rendered directly in the canvas.
✨ Features
- Difficulty menu: Easy, Normal, Hard.
- Ball speed adjusted by difficulty.
- Progressive speed increase during gameplay.
- Variable brick resistance (1 or 2 hits).
- Visual states for damaged bricks.
- Game Over message and keyboard restart.
- Responsive layout with no vertical scroll.
- Keyboard navigation in the difficulty menu.
🎯 Controls
| Action | Key |
|---|---|
| Move paddle | ← → or A D |
| Difficulty menu | ← → (↑ ↓ also supported) + Enter or Space |
| Restart after Game Over | any key |
🧰 Tech stack
- Astro (site and bundling)
- TypeScript (game logic)
- Canvas API (rendering)
- ESLint (code quality)
🗂️ Project structure
src/
pages/
index.astro
scripts/
breakout/
config.ts
state.ts
engine.ts
index.ts⚙️ Installation and usage
npm install
npm run devOpen in browser: http://localhost:4321
📜 Available scripts
| Script | Description |
|---|---|
npm run dev |
development mode |
npm run build |
production build |
npm run preview |
preview production build |
npm run typecheck |
type check (astro check) |
npm run lint |
TypeScript static analysis |
🤝 Contributing
Contributions are welcome. If you want to improve the game or propose new ideas:
- Open an issue first for major changes.
- Submit a Pull Request with a clear description.
- Keep code style consistent and pass all checks (typecheck, lint, build).
📄 License
This project is released under the MIT License. See LICENSE.
