A web-based Plinko game built with HTML5 Canvas and JavaScript. Drop balls from the top and watch them bounce through pegs to land in scoring boxes at the bottom!
- Interactive ball dropping mechanism
- Realistic ball physics with collision detection
- Scoring system with different point values
- Color-coded scoring boxes (Yellow: 100K, Silver: 10K, Grey: 5K, Blue: 1K, Green: 100)
- Pause/Resume functionality
- Real-time score display
- Responsive design with modern styling
- Click the "Drop Ball" button to release a ball from the top center
- Watch the ball bounce off the pegs as it falls down
- Earn points when the ball lands in a scoring box at the bottom
- Use "Pause" to pause the game, click again to resume
- Try to aim for the higher-scoring boxes on the edges!
- HTML5 - Canvas element for game rendering
- CSS3 - Modern styling and responsive design
- JavaScript - Game logic, physics, and animations
.
├── index.html # Main HTML file
├── style.css # Game styling and layout
├── script.js # Game logic and physics
└── README.md # This file
- Any modern web browser (Chrome, Firefox, Safari, Edge)
- Clone or download the project files
- Open
index.html
in your web browser - Start playing!
# If using a local server (optional)
# Open terminal in project directory and run:
python -m http.server 8000
# Then visit: http://localhost:8000
- Yellow boxes: 100,000 points (edges)
- Silver boxes: 10,000 points
- Grey boxes: 5,000 points
- Blue boxes: 1,000 points
- Green boxes: 100 points (center)
- Balls start from the center top
- Random direction changes when hitting pegs
- Collision detection between balls and pegs
- Box collision detection for scoring
- Drop Ball: Release a new ball
- Pause/Resume: Pause or resume the game animation
In script.js
, you can adjust:
radius
: Size of the pegsspacing
: Distance between pegsnumRows
: Number of peg rowsspeedY
: Ball falling speedboxScores
: Point values for boxes
Modify style.css
to change:
- Colors and themes
- Button styles
- Canvas border and background
- Game container appearance
- ✅ Chrome 60+
- ✅ Firefox 55+
- ✅ Safari 12+
- ✅ Edge 79+
- Uses
requestAnimationFrame
for smooth 60fps animation - Efficient canvas clearing and redrawing
- Collision detection optimized for performance
- Simple gravity simulation
- Collision detection using distance calculation
- Random bounce directions for unpredictability
- Modern UI with rounded corners and shadows
- Color-coded scoring system for easy recognition
- Responsive layout that centers on screen
- Multiple ball drops
- Sound effects
- High score saving
- Different difficulty levels
- Ball trail effects
- Mobile touch controls
- Multiplayer support
- Score display may overlap with canvas on very small screens
- Ball physics are simplified (no rotation or advanced bouncing)
This project is open source and available under the MIT License.
Feel free to fork this project and submit pull requests for improvements!
- Fork the project
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a pull request
Have fun playing Plinko and try to achieve the highest score possible!