A simple dice roller I built to practice JavaScript! Perfect for when you lose your dice during game night.
- Roll 1-6 dice at once
- Shows results as numbers and dice images
- Clean interface that's easy to use
- HTML for the structure
- CSS for styling
- Vanilla JavaScript for the fun stuff
- Download the files
- Open
index.htmlin your browser - Pick how many dice you want (1-6)
- Hit "Roll Dice" and see what you get!
Make sure you have the dice images in a dice_images folder (1.png through 6.png).
Pretty straightforward - I use Math.random() to generate numbers 1-6, then show both the numbers and matching dice images. The main function grabs your input, rolls the dice, and updates the page.
├── index.html # The main page
├── diceroller.js # Where the magic happens
├── s10.css # Makes it look nice
└── dice_images/ # Your dice pictures
Go for it! You could:
- Add more dice types (D20 anyone?)
- Make it look prettier
- Add sound effects
- Fix that typo where I wrote "numbers" instead of "number" 😅
Simple project, but it was fun to build and actually useful. Sometimes the best way to learn is by making something you'd actually use.
Happy rolling! 🎲