A classic Pong game implemented in HTML5 Canvas and JavaScript. Play against an AI opponent using mouse controls.
- Mouse Controls: Control the left paddle with your mouse
- AI Opponent: The right paddle is controlled by a simple AI
- Score Tracking: Keep track of scores for both players
- Collision Detection: Realistic ball physics with paddle collision
- Responsive Design: Clean, dark-themed interface
- Open index.html in your web browser
- Move your mouse up and down to control the left paddle
- Try to hit the ball past the AI opponent's paddle
- First to score wins!
- Mouse Movement: Control left paddle position
- The AI automatically controls the right paddle
├── index.html # Main HTML file
├── script.js # Game logic and mechanics
├── styles.css # Styling and layout
├── README.md # Project documentation
└── .vscode/
└── launch.json # VS Code debug configuration
Simply open index.html in any modern web browser, or use the VS Code launch configurations:
- Launch Microsoft Edge: Opens the game in Edge browser
- Launch Edge Headless and attach DevTools: For debugging
- Launch Edge and attach DevTools: For development with DevTools
Key game settings can be modified in script.js:
PADDLE_SPEED
: How fast paddles move (default: 5)BALL_SPEED
: Initial ball velocity (default: 5)PADDLE_WIDTH
&PADDLE_HEIGHT
: Paddle dimensions- Canvas size: 900x500 pixels
- Built with vanilla JavaScript and HTML5 Canvas
- Uses
requestAnimationFrame
for smooth 60fps gameplay - Implements basic physics for ball movement and collision
- AI uses simple tracking algorithm to follow the ball
Works in all modern browsers that support HTML5 Canvas:
- Chrome/Edge
- Firefox
- Safari
- Opera
This project is open source and available under the MIT License.