A classic Pong game built with modern web technologies.
- Astro - Static site generator web framework
- TypeScript - Static typing for JavaScript
- Preact - Lightweight React alternative for game logic
- Tailwind CSS - Utility-first CSS framework for styling
- Fully functional 2-player Pong game
- Single-player mode with AI opponent
- Multiple AI difficulty levels (Easy, Medium, Hard)
- Responsive keyboard controls
- Scoring system
- Realistic collision physics
- Modern interface with visual effects
- Modular, well-typed codebase
-
Player 1:
W- Move paddle upS- Move paddle down
-
Player 2:
↑- Move paddle up↓- Move paddle down
- Player:
W- Move paddle upS- Move paddle down
- AI: Automatically controls the right paddle
- Clone the repository:
git clone https://github.com/zkjon/pong.git
cd pong- Install dependencies:
bun install- Start the development server:
bun dev- Open your browser at
http://localhost:4321
| Command | Action |
|---|---|
bun install |
Install dependencies |
bun dev |
Start development server at localhost:4321 |
bun build |
Build the site for production in ./dist/ |
bun preview |
Preview the local build |
bun astro ... |
Run CLI commands like astro add, astro check |
bun astro -- --help |
Get help using Astro CLI |
- Modular architecture: Clear separation between logic, types, and utilities
- Strong typing: TypeScript throughout for robustness
- Custom hooks: Efficient keyboard event handling
- Canvas API: Smooth, efficient game rendering
- Responsive design: Adapts to different screen sizes
- Visual effects: Modern animations and styles with Tailwind
Contributions are welcome! Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to your branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
- AI for single player mode
- Multiple difficulty levels
- Sound effects
- Online multiplayer mode
- Different visual themes
- Achievement system
Enjoy playing Pong! 🏓
